【发布时间】:2011-11-04 11:31:33
【问题描述】:
我一直在研究 ipad 应用程序。在这个应用程序中,我有几个视图。这是流程
欢迎屏幕 > 主屏幕 > 其余屏幕
我在所有屏幕的导航栏上都应用了主页图标(按钮)。在任何屏幕上按下主页图标都会将用户带到主屏幕。我在Home类的viewDidLoad中写了如下代码
//**** Home button on navigation bar ****//
CGRect frame1 = CGRectMake(975.0, 4.0, 35, 35);
UIImage *buttonImage1 = [UIImage imageNamed:@"HomeIcon.png"];
UIButton *homeButton = [UIButton buttonWithType:UIButtonTypeCustom];
homeButton.frame = frame1;
[homeButton setBackgroundImage:buttonImage1 forState:UIControlStateNormal];
homeButton.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
homeButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
[homeButton addTarget:self action:@selector(goHome:) forControlEvents:UIControlEventTouchUpInside];
[homeButton setBackgroundColor:[UIColor clearColor]];
[self.navigationController.navigationBar addSubview:homeButton];
这个按钮是有效的。 goHome 是@selector 中应用的方法的名称。 我想从主屏幕中删除此按钮并将其保留在其余屏幕上。我已经应用了几件事,但我不知道该怎么做。这似乎很简单,但我仍然没有得到它。请指导..
问候 电脑
【问题讨论】:
标签: objective-c ios ipad