IOS equivalent of Android fragments / layouts

On Android, you can use Snippets to develop only one application for phones and spreadsheets, so you may have a different user interface. You can even use only layouts and have some condition for the code to run table or telephone logic.

I need to develop an application for the iPhone and iPad, and I wonder if there is something similar for implementing different user interfaces and a little different behavior. In my case, the iPhone application will use the tabs at the bottom of the screen, but the iPad should use the menu on the left side.

+6
source share
2 answers

Yes, you can use a different interface for iPhone and iPad. Create two XIB and, showing them on the screen, use this condition to start XIB

 UIViewController *viewController; if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil] autorelease]; } else { viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil] autorelease]; } [self.navigationController pushViewController:viewController animated:YES]; 
+2
source

UIViewController and XIB respectively.

Also see Creating a universal application .

0
source

Source: https://habr.com/ru/post/921023/


All Articles