- 博客(35)
- 收藏
- 关注
原创 安装ipa
1.手机连上电脑,iTunes打开2.点击手机的图标3.在商店的按钮里->对这台电脑授权4.在iTunes里打开应用5.双击ipa包6.在应用里就可以找到
2016-04-08 10:49:02
295
原创 UISlider(滑块控件)
1.一条属性@property(nonatomic,retain)UISlider *slider;2.设置滑块的基本内容self.slider = [[UISlideralloc] initWithFrame:CGRectMake(100,400, 200, 20)]; [self.viewaddSubview:self.slider];
2015-08-09 14:55:06
320
原创 毛玻璃效果
//**毛玻璃 UIImageView *imageview=[[UIImageViewalloc] initWithImage:[UIImageimageNamed:@"1221_01.jpeg"]]; imageview.frame=CGRectMake(0,0, self.view.frame.size.width,self.view
2015-08-09 14:49:44
293
原创 UITableView
- (void)viewDidLoad { [superviewDidLoad]; self.view.backgroundColor=[UIColorcyanColor]; self.navigationController.navigationBar.translucent=NO; self.title=@"表视图"; //按
2015-08-08 21:23:40
229
原创 UITableView省市区字典
一.1.定义一个省数组的属性@property(nonatomic,retain)NSMutableArray *proArr;2.对数组初始化-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{ self=[su
2015-08-08 21:00:21
280
原创 播放音乐并调节音量
1.两条属性@property(nonatomic,retain)UIStepper *stepper;@property(nonatomic,retain)AVAudioPlayer *play;2.播放 NSString *path=[[NSBundlemainBundle] pathForResource:@"盛夏光年"ofType:@"
2015-08-04 20:55:46
884
原创 手势识别器(UIImageView)
//1** UIImageView UIImage *image=[UIImageimageNamed:@"a944621500d792503e95f7077dec376b.jpg"]; self.imageView=[[UIImageViewalloc] initWithImage:image]; self.imageView.frame=CGRec
2015-08-04 20:34:13
319
原创 UISwitch
1.创建self.switch1=[[UISwitchalloc] initWithFrame:CGRectMake(100,200, 150, 50)]; [self.viewaddSubview:self.switch1]; [self.switch1release];2.颜色 self.switch1.onTintColor=[
2015-08-03 20:44:06
257
原创 Target-Action(View实现button的效果)
1.创建一个根视图控制器2.创建一个MyButton的类继承于UIView3.在MyButon的.h里//通过MyButon实现button的点击效果//1.通过自定义的方法,把目标和动作传到类的内部-(void)addNewTarget:(id)target Action:(SEL)action;//target:目标,button执行哪一个类的方法,对应
2015-08-03 20:33:55
507
原创 Touch和Motion的方法
1.他们都是UIResponder里的方法(UIView和UIViewController都继承于UIResponder)//触摸//点空白处回收键盘写在触摸开始的方法里-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@"触摸开始"); //点空白
2015-08-03 20:28:03
479
原创 视图的移动
1.创建根视图控制器2.创建一个MyView的类继承于UIView3.在MyView的.m里//补上延展@interface MyView()//用来记录视图开始的坐标@property(nonatomic,assign)CGPoint startPoint;@end4.在实现部分完成视图移动-(void)touchesBeg
2015-08-03 20:20:45
343
原创 Controller里视图的出现,消失方法
#pragma mark 视图将要出现-(void)viewWillAppear:(BOOL)animated{ [superviewDidAppear:animated]; NSLog(@"%s",__FUNCTION__);}//视图已经出现//手动加警告#warning 这个方法是视图已经出现-(void)vie
2015-08-03 08:46:34
823
原创 多个Controller之间的跳转
1.首先创建一个RootViewController和一个SecondViewController在RootViewController.m里引头文件RootViewController ->SecondViewController写一个Button,给Button添加一个Click方法[button addTarget:selfaction:@selector(cli
2015-08-03 08:43:11
360
原创 UIViewController视图控制器(移动self.view,随机颜色)
***//UIViewController不能直接使用,要定义一个子类,继承于它,用子类创建,UIViewController提供模板1.初始化方法//VC的初始化方法,这个方法一般自己就调用了,不需要我们再额外的去调用,会初始化一些容器,比如数组字典等-(instancetype)initWithNibName:(NSString *)nibNameOrNil
2015-08-03 08:15:20
344
原创 LTView
创建一个LTView的类在LTView的.h里签协议 UITextFieldDelegate>在LTView的.h里写属性//因为要在类的外部获取输入框的内容,修改label的标题,所以我们可以把这两部分作为属性写在.h,这样在外部可以直接进行修改和设置@property(nonatomic,retain)UILabel *myLabel;@property(n
2015-08-02 13:24:32
232
原创 点击按钮改变textField的状态
创建一个TextField//创建一个按钮,用来textfield切换状态 UIButton *changePicbutton=[UIButtonbuttonWithType:UIButtonTypeSystem]; changePicbutton.frame=CGRectMake(100,200, 50, 50); [changePicb
2015-08-02 13:22:10
529
原创 判断密码长度
//写一个label self.label=[[UILabelalloc] initWithFrame:CGRectMake(100,50, 100, 30)]; self.label.layer.borderWidth=1; self.label.backgroundColor=[UIColorclearColor]; [sel
2015-08-02 13:14:47
1145
原创 NSTimer
self.time=[NSTimer scheduledTimerWithTimeInterval:0.5target:selfselector:@selector(randomName:)userInfo:nilrepeats:YES];实现NSTimer里的方法-(void)randomName:(id)sender{
2015-08-02 12:24:03
274
原创 UITextField(可以输入文本),改变return样式,键盘回收,添加辅助视图
1.//1.创建一个UITextField(同UIView的4步) UITextField *field=[[UITextFieldalloc] initWithFrame:CGRectMake(100,100, 100, 50)]; field.backgroundColor=[UIColorwhiteColor]; [self.windowa
2015-08-01 20:30:37
533
原创 UILabel
//1.Label的创建(同UIView的4步) UILabel *label=[[UILabelalloc] initWithFrame:CGRectMake(100,100, 150, 150)]; label.backgroundColor=[UIColorpurpleColor]; [self.windowaddSubview:labe
2015-08-01 20:24:17
231
原创 UIButton
//用button自己的便利构造器的方式来创建对象 UIButton *button= [UIButton buttonWithType:UIButtonTypeSystem]; //指定button的位置和大小 button.frame=CGRectMake(100,100, 150, 70); //设置背景颜色 butt
2015-07-30 20:58:33
180
原创 UIView
1.window//创建一个和屏幕一般大的window self.window = [[UIWindowalloc] initWithFrame:[[UIScreenmainScreen] bounds]]; // Override point for customization after application launch. //
2015-07-30 20:47:05
175
原创 数组的排序
//1.数组对字符串的排序//不可变数组NSArray *arr=@[@"sunxiang",@"liyang",@"wangye",@"dage",@"chengyang"]; //SEL是方法选择器,它是方法选择器的类型 NSArray *newarr=[arr sortedArrayUsingSelector:@selector(compare:)]
2015-07-28 21:11:33
173
原创 多态
一.定义一个BaseModel的类在.h文件中@property(nonatomic,copy)NSString *name;@property(nonatomic,copy)NSString *sex;-(id)initWithName:(NSString *)name sex:(NSString *)sex;
2015-07-28 21:02:05
260
原创 block
//1.无参数,无返回值//block自己不会执行,必须调用才会执行block里的代码段 void(^block)()=^(){ NSLog(@"大傻子"); }; block();//2.有参数,无返回值 void(^block)(NSInteger,NSInteger)=^(NSInteger a,N
2015-07-28 20:58:41
253
原创 内存管理
1.管理内存有3种方式 //一:垃圾回收,java常见的管理内存的方法,系统来检测对象是否被使用,是否被释放 //二:MRC手动管理引用计数,ios管理内存的方式,程序员通过手动的方式来管理对象是否被释放, //三:ARC自动管理引用计数,基于MRC,系统自动的管理内存,以后我们还是先使用MRC,培养管理内存的习惯2.对象被创建出来之后,它
2015-07-27 18:41:48
283
原创 不可变数组转变为可变数组
//不可变数组变为可变数组1. NSArray *arr=@[@"1",@"2",@"3"]; NSMutableArray *arr1=[[NSMutableArrayalloc] initWithObjects:arr,nil]; [arr1addObject:@"6"]; NSLog(@"%@",arr1);打印结果:2015
2015-07-25 09:09:30
1169
原创 延展-协议-类目
一.延展//1.延展以@interface开头,然后写当前延展的类名,类名后加一个().到@end结束//2.一般延展会写在自己写的.m文件中,把一些不想让外部调用的属性放在延展里,这样这条属性只能够在类的内部使用,外部使用不了,尽最大可能保护当前类的安全//3.类目一般是给看不见.m的文件进行扩展,延展一般是针对自己的类进行操作@interface Stude
2015-07-24 20:23:52
340
原创 NSDate日期的类
一. //NSDate是一个日期的类 //1.date:无论在哪个时区,date获取的时间是相对应的零时区时间 NSDate *date=[NSDatedate]; NSLog(@"%@",date); //2.先获取当前所在的时区 NSTimeZone *zone=[NSTimeZonesystemTimeZo
2015-07-23 19:45:19
224
原创 NSSet集合
//1.NSSet 集合:集合是无序的,集合不能有重复的元素,集合里的元素必须是对象类型 NSSet *set=[NSSetsetWithObjects:@"1",@"2",@"3",@"4",@"5",nil]; NSLog(@"%@",set); NSLog(@"%ld",set.count); //返回其中的某一个元素 NSL
2015-07-23 18:43:50
282
原创 NSNumber,NSValue
//1.值对象//把基本数据类型转换成对象类型 //*NSInteger ->NSNumber NSInteger a=10; NSNumber *number=[[NSNumberalloc] initWithInteger:a]; NSLog(@"%@",number); //**NSNumber ->NSInte
2015-07-23 18:34:50
267
原创 OC_字符串NSString
//输入一个字符串 NSString *str=@"sunxiang孙祥";//1.求字符串长度 NSLog(@"%ld",str.length);打印结果:2015-07-20 17:28:32.700 0720练习[2083:303] 10//2.characterAtIndex:通过指定下标获取字符串内容,%c-打印字母,%C-打印汉字
2015-07-20 17:33:08
430
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人