怎么给uibarbuttonitem添加点击方法
1个回答
展开全部
UIImage* backImage = [UIImage imageNamed:@"btn_back.png"];
CGRect backframe = CGRectMake(0,0,54,30);
UIButton* backButton= [[UIButton alloc] initWithFrame:backframe];
[backButton setBackgroundImage:backImage forState:UIControlStateNormal];
[backButton setTitle:@"直播" forState:UIControlStateNormal];
backButton.titleLabel.font=[UIFont systemFontOfSize:13];
[backButton addTarget:self action:@selector(doClickBackAction:)forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem* leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:backButton];
UIBarButtonItem* leftBarButtonItem = [[UIBarButtonItem alloc] init];
self.navigationItem.leftBarButtonItem = leftBarButtonItem;
[leftBarButtonItem release];
[backButton release];
CGRect backframe = CGRectMake(0,0,54,30);
UIButton* backButton= [[UIButton alloc] initWithFrame:backframe];
[backButton setBackgroundImage:backImage forState:UIControlStateNormal];
[backButton setTitle:@"直播" forState:UIControlStateNormal];
backButton.titleLabel.font=[UIFont systemFontOfSize:13];
[backButton addTarget:self action:@selector(doClickBackAction:)forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem* leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:backButton];
UIBarButtonItem* leftBarButtonItem = [[UIBarButtonItem alloc] init];
self.navigationItem.leftBarButtonItem = leftBarButtonItem;
[leftBarButtonItem release];
[backButton release];
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询