- 博客(10)
- 收藏
- 关注
原创 iOS之拼图小游戏
首先找到这8张图片,还需要一张空白的图片,自己随便剪一张吧。 定义三个属性:button可变数组,图片可变数组,正确顺序的图片数组。@property(retain, nonatomic)NSMutableArray *buttonArray; @property(retain, nonatomic)NSMutableArray *a; @property(retain, nonatomic)NS
2015-11-21 15:06:12 566 1
原创 iOS之关灯小游戏
先创建一对ViewController文件,用来编写开灯关灯的实现 LightViewController.h LightViewController.m在.h文件里定义两个属性,一个line:灯的行数,col:灯的列数 @property(assign, nonatomic)NSInteger line; @property(assign, nonatomic)NSInteger col;
2015-11-21 12:04:04 414
原创 ViewController的页面跳转
ViewController的页面跳转 创建要跳转的密码ViewController PasswordViewController *p =[[PasswordViewController alloc]init]; 定义跳转风格 p.modalTransitionStyle = UIModalTransitionStyleCoverVertical; 当前页面跳转到P
2015-11-21 11:26:42 266
原创 利用touches方法拖动视图移动
拖动视图 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@"摸我了"); self.backgroundColor = [UIColor colorWithRed:arc4random() % 256 / 255.0 green:arc4random() % 256 /255.
2015-11-21 11:26:04 297
原创 图片数组形成动画(UIImageView)
图片数组形成动画(UIImageView) UIImage *image = [UIImage imageNamed:@"iphone"]; //创建UIImageView来显示图片 self.firstImageView = [[UIImageView alloc] initWithImage:image]; self.firstImageVi
2015-11-21 11:24:30 554
原创 手势
手势 addGestureRecognizer:给视图添加手势,然后再实现@selector( )里的方法 轻拍(tap) UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)]; //设置轻拍
2015-11-21 11:23:24 180
原创 UIButton控件
UIButton控件 UIButton *myButton = [UIButton buttonWithType:UIButtonTypeCustom];//创建一个自定义的Button,Custom(自定义) Button属性 添加点击事件/移除按钮的点击事件 addTarget/removeTarget setImage: forState: 设置指定
2015-11-21 11:20:22 241
原创 向AddressBook里添加联系人
向AddressBook里添加联系人(没分组创建分组,有分组加联系人) -(NSMutableDictionary *)addContactToAddressBook:(NSMutableDictionary *)addressBook{ // for (Contact *contact in mulArray) { //获得当前联系人的姓名首字母
2015-11-21 11:12:26 392
原创 去除字符串内的相邻的重复字
// 去除字符串内的相邻的重复字符,例如:aabdaaadesff,最后结果abdadesf NSMutableString *str =[NSMutableString stringWithFormat: @"IIII''mm aalleexxxxxxxxiinnhhoo"]; NSInteger i = 0; while (i
2015-11-21 11:10:22 583
原创 字符反转输出
//字符反转输出 void practice_6(){ char str[] = "this is mother fuck trap music"; int length = (int)strlen(str); char *head = str; char *tail = str + length -1; while (head
2015-11-21 10:59:26 341
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人