首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

给初学者写的tapGesture和返回按钮写法的示例

2014-01-13 
给菜鸟写的tapGesture和返回按钮写法的示例菜鸟真的很菜,还不爱学习,不怕神一样的对手,只怕不爱学习的菜鸟

给菜鸟写的tapGesture和返回按钮写法的示例
菜鸟真的很菜,还不爱学习,不怕神一样的对手,只怕不爱学习的菜鸟。

- (void)viewDidLoad{    [super viewDidLoad];        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];    UIImage *returnBtnImage = [UIImage imageNamed:@"return_btn.png"];    [btn setFrame:CGRectMake(0, 0, returnBtnImage.size.width, returnBtnImage.size.height)];    [btn setBackgroundImage:returnBtnImage forState:UIControlStateNormal];    [btn setTitle:@"  返回" forState:UIControlStateNormal];    [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];    [btn.titleLabel setFont:[UIFont boldSystemFontOfSize:12]];    [btn addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];        UIBarButtonItem *backBtn = [[UIBarButtonItem alloc]initWithCustomView:btn];    self.navigationItem.leftBarButtonItem = backBtn;        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 30, 30)];    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapCheck:)];    tap.numberOfTapsRequired = 1;    [imageView addGestureRecognizer:tap];}

热点排行