我想设计类似于附加屏幕设计的back button。单击后退按钮主屏幕出现。我该怎么做?注意:不使用导航栏
答案 0 :(得分:0)
使用以下代码创建按钮。
UIButton yourButton = [UIButton buttonWithType:UIButtonTypeCustom];
[yourButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[yourButton setTitle:@"BACK" forState:UIControlStateNormal];
[yourButton setImage:[UIImage imageNamed:@"back_arrow_image_name.png"] forState:UIControlStateNormal];
[yourButton setBackgroundImage:[UIImage imageNamed:@"bg_image_name.png"] forState:UIControlStateNormal];
[yourButton addTarget:self action:@selector(backButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
-(void)backButtonClicked:(UIButton*)sender
{
//code for navigate to home page
}