Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 1    Views: 55

mjharris
Aspiring developer
Profile
Posts: 19
Reg: May 23, 2013
Boulder
3,440
06/13/13 07:25 PM (12 years ago)

BTA Design Menu - Centering Text

Hey there, I am using the BTA Design Menu to display text of different length. I want to have the text centered (horizontally and vertically) in the cell instead of predefining the left and top start point. How can I hack this together in Objective C? P.S. It would also be cool if I could dynamically change the size of the cell depending on the amount of content in it too, but that would just be gravy. Right now I am planning on just making each cell as big as the largest cell needs to be. Thanks for your help in advance, Max
 
mjharris
Aspiring developer
Profile
Posts: 19
Reg: May 23, 2013
Boulder
3,440
like
06/13/13 10:34 PM (12 years ago)
I actually was able to figure out how to center the text. Since my first goal was just to center a short title I edited "titleleft" in BTA_cell_designMenu.m. //Center the title text UIFont *myFont = [UIFont fontWithName:titelFontFamily size:titleFontSize]; CGSize stringBoundingBox = [titleText sizeWithFont:myFont]; titleLeft = 160 - .5 * stringBoundingBox.width; Since titelFontFamily (it actually is spelled "titel") and titleFontSize are defined after titleLeft, I had to cut and paste before it. Now if I can just dynamically re-size the height of the cells...
 

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.