开发者

Table and normal view inside of Tab Bar. Cannot see text on Bars

开发者 https://www.devze.com 2023-02-08 09:00 出处:网络
I am attempting to create an app where there is a tab bar on the bottom, and the first tab is supposed to be labeled \"Bets\" and the second is to be labeled \"Settings\". However, I attempted to chan

I am attempting to create an app where there is a tab bar on the bottom, and the first tab is supposed to be labeled "Bets" and the second is to be labeled "Settings". However, I attempted to change it in IB but it seems as though something is blocking the text from being seen, although you can see the bar and buttons at the bottom

DollarBetAppDelegate.h

#import <UIKit/UIKit.h>
#import "User.h"

@interface DollarBetAppDelegate : NSObject <UIApplicationDelegate,     
UITabBarControllerDelegate> {
    UIWindow *window;
    UITabBarController *tabBarController;
    UINavigationController *navController;
    User *main;

}
@property (nonatomic,retain)User *main;
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;


@end

DollarBetAppDelegate.m

#import "DollarBetAppDelegate.h"
#import "BetsViewController.h"
#import "SettingsViewController.h"
#import "User.h"
#import "Bet.h"

@implementation DollarBetAppDelegate

@synthesize window;
@synthesize tabBarController;
@synthesize main;

#pragma mark -
#pragma mark Application lifecycle

- (BOOL)application:(UIApplication *)application 
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

// Override point for customization after application launch.
main = [[User alloc]init];
Bet *bet;
bet = [[Bet alloc]init];


NSLog(@"bet.betDesc = %@ \n", bet.betOwner);

[main.betArray addObject:(Bet*)bet];

// Add the tab bar controller's view to the window and display.
BetsViewController *bvc = [[BetsViewController alloc] init];
SettingsViewController *svc = [[SettingsViewController alloc]init];
bvc.mainUser  = main;

navController = [[UINavigationController alloc] initWithRootViewController:bvc];
[bvc release];

tabBarController.viewControllers = [NSArray arrayWithObjects:navController, svc, 
    nil]; 
[navController release];
[svc release];

[self.window addSubview:tabBarController.view];
[self.window makeKeyAndVisible];

return YES;
}




#pragma mark -
#pragma mark Memory management

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
/*
 Free up as much memory as possible by purging cached data objects that can be recreated 
(or reloaded from disk) later.
 */
}


- (void)dealloc {
    [tabBarControl开发者_运维百科ler release];
    [window release];
    [super dealloc];
}

@end

This is the end result when compiled

http://i55.tinypic.com/2zduf7c.png

If any other files are needed, let me know.

I appreciate any input.


From the UITabBarController class reference:

"If you do not provide a custom tab bar item for your view controller, the view controller creates a default item containing no image and the text from the view controller’s title property."

Your view controllers (BetsViewController and SettingsViewController) should set the title property in the initializer method.

0

精彩评论

暂无评论...
验证码 换一张
取 消