Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 3    Views: 69

ManojKulwal
Aspiring developer
Profile
Posts: 7
Reg: Jun 04, 2012
Reading, UK
5,960
11/05/12 03:06 PM (13 years ago)

How to get label for Menu Button to spread across two lines?

Hello - In my app, I am using Menu Buttons and want label "Success Factors" for one of the menu button. However, the label is displayed as "Success ..." in iOS simulator within xCode. So I am assuming there is some constraint around number of texts for menu labels. What can I change to word wrap the label and display "Success Factors" over 2 lines. Manoj
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/05/12 11:20 PM (13 years ago)
Hi in UK. Yup...makes perfect sense. There is not a built in method to do this. The idea is that the labels will either be "wide enough" to fit your text, or truncated, like you found. But, you can adjust whatever you want after you download your project. There aren't any limits to this stuff, only what you're comfortable changing (it can get tricky). In your project, in Xcode, expand the bt_screen_menuButtons folder in Xcode. You'll see four files for this plugin. One is the "screen" of buttons (the UIViewController) the other is the UIView for each button. Find this on about line 486: [buttonLabel setNumberOfLines:1]; Set this to 2 maybe? You'll also need to adjust the size of the "box" around the label (called a frame in iOS) and the size of the "box" that holds each button and label. Hope this helps.
 
ManojKulwal
Aspiring developer
Profile
Posts: 7
Reg: Jun 04, 2012
Reading, UK
5,960
like
11/06/12 02:42 PM (13 years ago)
Hello Dave - thank you for your response. I tried to change the setNumberOfLines option to 2 but did not see any change in the simulator. The labels are still truncated. Any other suggestions?
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
11/06/12 09:14 PM (13 years ago)
Hmm...did you also make the "frame" for the UILabel "tall enough" to accomodate both lines of text? It's hard to say how iOS will handle this without tinkering a bit. Have a look in the code (search) for labelRect. This label rectangle variable is the size of the UILabel's box. It needs to be tall enough to hold both text lines.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.