iphone - Best way to add a UIViewController on top of another UIViewController -
what best way add uiviewcontroller on top of uiviewcontroller present on iphone. there 2 ways know of. there better way? 1 of these better, if not?
1. [self presentmodalviewcontroller:controller animated:no]; 2. [self.view addsubview:somecontroller.view];
[[self view] addsubview: [otherviewcontroller view]]; cgrect frame = [[self view] frame]; int direction = 1; switch (direction) { case 0: // bottom frame.origin.y = [[self view] frame].size.height; [[otherviewcontroller view] setframe: frame]; frame.origin.y = 0.0 - [[self view] frame].size.height; break; case 1: // right frame.origin.x = [[self view] frame].size.width; [[otherviewcontroller view] setframe: frame]; frame.origin.x = 0.0 - [[self view] frame].size.width; break; } [uiview animatewithduration: 1.0 delay: 0.0 options: uiviewanimationoptioncurveeaseinout animations:^{ [[self view] setframe: frame]; } completion: ^(bool finished) { } ];
Comments
Post a Comment