Chatar Veer Suthar
Chatar Veer Suthar

Reputation: 15639

how can I navigate to another controller without UINavigationControler?

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

Upvotes: 1

Views: 133

Answers (2)

Krishnabhadra
Krishnabhadra

Reputation: 34285

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...

Upvotes: 1

Dipanjan Dutta
Dipanjan Dutta

Reputation: 111

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

Upvotes: 1

Related Questions