Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-22-2011, 05:48 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 1
nothingatall is on a distinguished road
Unhappy UISplitView controller toolbar not showing in detail view

Hi guys, I have set up a UISplitView controller which deals with multiple detail views programmatically. This is based on the apple example here

However I am having major issues with getting the toolbar to show up in any of my detail views (and thus the popover)! I get the idea that I am not initializing and adding it to the view correctly (if at all) but none of my attempts are working!

If someone could give me some thoughts/advice/help etc that would be reallyREALLY handy! I have added some code below (yes, I know it is messy.. and well... like I say, I'm really unsure on the way to do this!).

Apologies, I'm not the best person at this iOS programming malarky(!)

CategoriesViewController_iPad.h
Code:
#import <UIKit/UIKit.h>
#import "RootViewController_iPad.h"

@interface CategoriesViewController_iPad : UITableViewController <SubstitutableDetailViewController>
{
	UIToolbar *toolbar;    
}
	
@property (nonatomic, retain) UIToolbar *toolbar;
	
@end
CategoriesViewController_iPad.m
Code:
@synthesize toolbar;

#pragma mark -
#pragma mark - View lifecycle
- (void)viewDidLoad
{
    [super viewDidLoad];
	
	[self.tableView initWithFrame:self.tableView.frame style:UITableViewStylePlain];
	self.navigationItem.title = NSLocalizedString(@"Categories", @"DetailView Categories");
	self.view.backgroundColor = [UIColor orangeColor];

	[self.view addSubview:toolbar];
	
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
	self.navigationController.toolbarHidden = NO;
	self.navigationController.toolbar.barStyle = UIBarStyleDefault;
}

- (void)viewDidUnload
{
	[super viewDidUnload];
	self.toolbar = nil;
}
nothingatall is offline   Reply With Quote
Old 08-22-2011, 11:10 AM   #2 (permalink)
Fly-by-night Innovator
 
Join Date: Jun 2010
Posts: 364
musicwind95 is on a distinguished road
Default

Well, your toolbar isn't an IBOutlet, so it's not being initialized with any XIB. Therefore, most likely it is nil and has no frame (as I recall, the default value for floating-point values in undefined…but I may be mistaking that for something else).

Try this:

Code:
- (void)viewDidLoad {
    // Other setup
    if (!self.toolbar) {
        // Retain property—don't use setter to maintain +1 retain count from init
        toolbar = [[UIToolbar alloc] initWithFrame:someCGRectForToolbar];
        // Other setup for toolbar properties (style, tint)
    }
    [self.view addSubview:self.toolbar];
}
__________________
If I have helped you, please consider donating. I use PayPal. It would mean a lot to me!


For more iOS Development, check out my blog—Cups of Cocoa. All visitors welcome, but especially beginners!

Hope I have helped!

Please check out IceFall, a new action game available in the App Store!
musicwind95 is offline   Reply With Quote
Reply

Bookmarks

Tags
ipad, toolbar, uisplitviewcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 399
13 members and 386 guests
7twenty7, cristofercolmbos, dedeys78, fiftysixty, gmarro, iOS.Lover, jonathandeknudt, Matrix23, raymng, stanny, tymex, UMAD, xerohuang
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,669
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dedeys78
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:13 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0