在没有 UINavigationControler 的情况下如何导航到另一个控制器?
我在 ViewController 的 ViewDidLoad 中有以下编码
- (void)viewDidLoad {
[super viewDidLoad];
UIImageView* view = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"logo.png"]];
view.frame = CGRectMake(300, 200, 200, 350);
[self.view addSubview:view];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(300, 800, 200, 50)];
label.textColor = [UIColor blackColor];
[label setBackgroundColor:[UIColor clearColor]];
[label setFont:[UIFont systemFontOfSize:30]];
[label setText: @"Tap to Enter"];
[self.view addSubview:label];
[label release]; }
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"Hello, You Tapped !"); }
现在我想点击并切换到另一个控制器,并且我想要 UITabBarController 他们的,我该怎么做?
如果还有人不清楚可以再问我
I have following coding in my ViewDidLoad of ViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIImageView* view = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"logo.png"]];
view.frame = CGRectMake(300, 200, 200, 350);
[self.view addSubview:view];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(300, 800, 200, 50)];
label.textColor = [UIColor blackColor];
[label setBackgroundColor:[UIColor clearColor]];
[label setFont:[UIFont systemFontOfSize:30]];
[label setText: @"Tap to Enter"];
[self.view addSubview:label];
[label release]; }
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"Hello, You Tapped !"); }
Now I want to tap and switch to another controller and I want UITabBarController their, how can I do that?
If anyone is not clear, may ask again to me
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将新控制器称为 modelviewController..这是一个选项..并且在 newController init tabController 的 viewDidLoad 中..
或者如果您想从右向左推送导航..您可以为新控制器的视图设置动画从右到左并将当前控制器的视图推到屏幕左侧..另一个选项..但我推荐第一个...
You can call the new controller as modelviewController..That is one option..and in the viewDidLoad of the newController init tabController there..
.Or If you want push navigation from right to left..You can animate the view of the new Controller from right to left and push the view of current controller outside to the left of the screen..another option..but I recommend first one...
点击一个按钮,您应该导航到另一个控制器。为按钮编写一个方法,并在视图中加载新控制器的方法,启动 tabbarcontroller
Take a button on tapping which you should be navigated to another controller. Write a method for the button and in the view did load method of the new controller, initiate the tabbarcontroller