How to set a multiline as title of a UIButton
in iPhone programming ?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
Please don't use subviews.
this is the right way to do this. There is a tutorial on this for the German community!
http://bedifferently.wordpress.com/2011/11/16/uibutton-bearbeite-den-titel-teil-1/
Be sure to try to get in the habit of consulting the documentation before posting a question. Apple's documentation is pretty comprehensive, and things like this generally get covered.
UIButton doesn't display multiple lines. The way to make it do so is to addSubview a UILabel to the button
Hi,
There is a property of UIButton called lineBreakMode which will allow you to add multiline titles. The two main things I would set it to are UILineBreakModeWordWrap or UILineBreakModeCharacterWrap.
UILineBreakModeWordWrap wraps the last word and UILineBreakModeCharacterWrap wraps at the lastcharcter.
looks like:
instanceOfUIButton.lineBreakMode = UILineBreakModeWordWrap;
or
instanceOfUIButton.lineBreakMode = UILineBreakModeCharacterWrap;
hope that's what your after