- 博客(10)
- 收藏
- 关注
原创 iOS之拼图小游戏
首先找到这8张图片,还需要一张空白的图片,自己随便剪一张吧。 定义三个属性:button可变数组,图片可变数组,正确顺序的图片数组。@property(retain, nonatomic)NSMutableArray *buttonArray;@property(retain, nonatomic)NSMutableArray *a;@property(retain, nonatomic)NS
2015-11-21 15:06:12
583
原创 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
436
原创 ViewController的页面跳转
ViewController的页面跳转创建要跳转的密码ViewControllerPasswordViewController *p =[[PasswordViewController alloc]init];定义跳转风格p.modalTransitionStyle = UIModalTransitionStyleCoverVertical;当前页面跳转到P
2015-11-21 11:26:42
288
原创 利用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
319
原创 图片数组形成动画(UIImageView)
图片数组形成动画(UIImageView) UIImage *image = [UIImage imageNamed:@"iphone"]; //创建UIImageView来显示图片 self.firstImageView = [[UIImageView alloc] initWithImage:image]; self.firstImageVi
2015-11-21 11:24:30
574
原创 手势
手势addGestureRecognizer:给视图添加手势,然后再实现@selector( )里的方法 轻拍(tap) UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)]; //设置轻拍
2015-11-21 11:23:24
191
原创 UIButton控件
UIButton控件UIButton *myButton = [UIButton buttonWithType:UIButtonTypeCustom];//创建一个自定义的Button,Custom(自定义)Button属性添加点击事件/移除按钮的点击事件addTarget/removeTargetsetImage: forState: 设置指定
2015-11-21 11:20:22
260
原创 向AddressBook里添加联系人
向AddressBook里添加联系人(没分组创建分组,有分组加联系人)-(NSMutableDictionary *)addContactToAddressBook:(NSMutableDictionary *)addressBook{// for (Contact *contact in mulArray) { //获得当前联系人的姓名首字母
2015-11-21 11:12:26
418
原创 去除字符串内的相邻的重复字
// 去除字符串内的相邻的重复字符,例如:aabdaaadesff,最后结果abdadesf NSMutableString *str =[NSMutableString stringWithFormat: @"IIII''mm aalleexxxxxxxxiinnhhoo"]; NSInteger i = 0; while (i
2015-11-21 11:10:22
605
原创 字符反转输出
//字符反转输出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
359
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人