Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 29, 2012, 01:02 PM   #1
newtoiphonesdk
macrumors 6502a
 
Join Date: Jul 2010
UIBarButtonItem Not resizing to fit word

I have a Table View set up for the iPad. In the MainWindow-iPad.xib I have a navigation controller, with the Table View Class as the Root View Controller. On the .xib I have a Navigation Bar, View Controller with class of Table View and NIB of Table View. I then have a navigation item, with two buttons. One button reads Archive and is on the left hand side. The other button contains a UIProgressView. I also have placed a label on the navigation bar for when downloads are present it will show name of download, and progressview will be unhidden and show progress of download. However, on the iPad, the word Archive appears as Ar...ve. I have a feeling it is due to either the label or the Progress Bar being too wide, and not giving any room to the BarButtonItem for Archive, but I can't figure out why. ProgressView is added in xib, Label is added in viewDidLoad code:
Code:
progress.hidden = YES;
    CGRect frame = CGRectMake(600, -14, 170, 44);
    downloadlabel = [[UILabel alloc]initWithFrame:frame];
    downloadlabel.textAlignment =  UITextAlignmentCenter;
    downloadlabel.textColor = [UIColor blackColor];
    downloadlabel.backgroundColor = [UIColor clearColor];
    downloadlabel.font = [UIFont fontWithName:@"Arial Rounded MT Bold" size:(18.0)];
I have tried making frame (600, -14, 70, 44) but the button still shortens the button title. Any ideas?
newtoiphonesdk is offline   0 Reply With Quote
Old Mar 29, 2012, 07:12 PM   #2
PhoneyDeveloper
macrumors 68020
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
How do you add the label to the navbar? Can you show a screenshot of the top of the screen with the navbar?
PhoneyDeveloper is offline   0 Reply With Quote
Old Mar 29, 2012, 08:12 PM   #3
newtoiphonesdk
Thread Starter
macrumors 6502a
 
Join Date: Jul 2010
Quote:
Originally Posted by PhoneyDeveloper View Post
How do you add the label to the navbar? Can you show a screenshot of the top of the screen with the navbar?
I add the label when a file is being downloaded:
Code:
- (void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {

self.nameit = entry.articleTitle;
    downloadlabel.text = [NSString stringWithFormat:@"%@", nameit];
    [thebar addSubview:downloadlabel];
//some code removed
}


And during download:
Attached Thumbnails
Click image for larger version

Name:	IMG_0113.PNG
Views:	457
Size:	13.5 KB
ID:	333119   Click image for larger version

Name:	IMG_0114.PNG
Views:	455
Size:	21.0 KB
ID:	333120  

Last edited by newtoiphonesdk; Mar 29, 2012 at 08:15 PM. Reason: Added During Download pic
newtoiphonesdk is offline   0 Reply With Quote
Old Mar 30, 2012, 08:18 PM   #4
PhoneyDeveloper
macrumors 68020
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
UIBarButtonItem has a possibleTitles property. This is a list of titles that might be used. It doesn't resize itself if you set a title at a later time that's not in its list of possibleTitles.

UINavigationBar has a titleView property that is meant to be used to add a view to its center. I think I'd use that rather than addSubView to add a label.
PhoneyDeveloper is offline   0 Reply With Quote
Old Mar 31, 2012, 03:37 PM   #5
newtoiphonesdk
Thread Starter
macrumors 6502a
 
Join Date: Jul 2010
Quote:
Originally Posted by PhoneyDeveloper View Post
UIBarButtonItem has a possibleTitles property. This is a list of titles that might be used. It doesn't resize itself if you set a title at a later time that's not in its list of possibleTitles.

UINavigationBar has a titleView property that is meant to be used to add a view to its center. I think I'd use that rather than addSubView to add a label.
So, are you saying I should or shouldn't use possibleTitles property? Sounds like if I set something NOT in its possibleTitles that it should NOT resize itself, as it is doing now...
newtoiphonesdk is offline   0 Reply With Quote
Old Mar 31, 2012, 06:05 PM   #6
PhoneyDeveloper
macrumors 68020
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
Right. You should use the possibleTitles property if you can.
PhoneyDeveloper is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump


All times are GMT -5. The time now is 12:16 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC