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)];
la开发者_如何转开发bel.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
You can call the new controller as modelviewController..That is one option..and in the viewDidLoad of the newController init tabController there..
UIViewController *newViewController = [[UIViewController alloc] init];
[self presentModalViewController:newViewController animated:YES];
.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...
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
精彩评论