Ich muss für mein Projekt für zuerst kommenden Splash-Screen nach dann Home Geröll entwickeln. In diesem Startbildschirm befindet sich die Registerkarte auf der Unterseite. Bitte schlagen Sie irgendeinen vor. Wie geht es weiter? Ich brauche programmatischAdd Tabbar in Startseite in Objective c
-3
A
Antwort
1
zu verwenden, wenn Sie einen Tabbar auf einem bestimmten View-Controller erstellen möchten:
auf ViewController.h:
@property (nonatomic, retain) UITabBarController *tab;
auf ViewController.m
self.tab = [UITabBarController new];
// FirstViewController
FirstViewController *vc1=[[FirstViewController alloc] initWithNibName:nil bundle:nil];
[email protected]"First View Controller";
vc1.tabBarItem.image = [UIImage imageNamed:@"viewcontroller1.png"];
//SecondViewController
SecondViewController *vc2 = [[SecondViewController alloc]initWithNibName:nil bundle:nil];
[email protected]"Second";
vc2.tabBarItem.image = [UIImage imageNamed:@"viewcontroller2.png"];
self.tab.viewControllers = @[vc1, vc2];
[self.view addSubview:self.tab.view];
1
So erstellen Sie programmatisch eine Tab-Leiste mit einigen Navigations-Controllern darin. Aber ich empfehlen dringend So Drehbuch Stelle
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
//Alloc all the VC of the tab bar
UIViewController *firstViewController = [[UIViewController alloc] init];
UIViewController *secondViewController = [[UIViewController alloc] init];
UIViewController *thirdViewController = [[UIViewController alloc] init];
//Create the tab bar
UITabBarController *tabBarController = [[UITabBarController alloc] init];
//Set the array of the tab bar with the VCs
tabBarController.viewControllers = @[firstViewController, secondViewController, thirdViewController];
//create the navigation controller
UINavigationController *navigationController = [[UINavigationControlle alloc] initWithRootViewController:tabBarController];
// init the app with the tab bar
self.window.rootViewController = tabBarController;
//
[self.window makeKeyAndVisible];
return YES;
}
Verwandte Themen
- 1. Wie Font of Tabbar Titel in objective-C
- 2. schreibe eine Add-Attribut-Methode in Objective C
- 3. ARC in Objective-C
- 4. NSArrays in Objective-C verschmelzen
- 5. Kompiliere C# in objective-C
- 6. Destruktor in Objective-C++
- 7. Serverproblem in objective-c
- 8. Konstante in objective-c
- 9. Wie in Objective-C
- 10. Speicherzuordnung in Objective-C
- 11. Vererbungsprobleme in Objective C
- 12. Polymorphismus in Objective-c
- 13. Lokalisierungsproblem in Objective C
- 14. "Erweiterungsmethoden" in Objective-C
- 15. Stringvergleich in Objective-C
- 16. wie in Objective C
- 17. Zeitintervalle in Objective C
- 18. Wordnet in Objective-C
- 19. Befehlszeilenrechner in Objective C
- 20. Pi in Objective C
- 21. Gewinde in Objective-C
- 22. BDD in Objective-C
- 23. TabBar Innenansicht der TabBar
- 24. Tabbar Anwendung in iPhone
- 25. Startseite Armaturenbrett in Obi
- 26. Verwenden von Enum in Objective-C?
- 27. Tabbar und Org-Mode
- 28. String-Ersatz in Objective-C
- 29. Funktion Pointer in Objective C
- 30. Rubin || = äquivalent in Objective-C
Ich muss UIViewController Klasse nicht in Appdelegate Klasse – vikramarkaios
auf eine bestimmte Ansicht co schreiben Kinderwagen? Sie sollten Ihre Zweifel besser angeben. –
ja, ich muss spezifische Ansicht Controller implementieren – vikramarkaios