objective c - UIPickerView with Multiline UILabel -
I am currently working on it to install my core data from a program dynamically fills a picker view. I have all the data-wise work, but now the problem I am running is the formatting on my labels.
The picker is presented with its toolbar in a worksheet with the button on the right side of the toolbar, with the initial state 2 dial view. When the button is pressed, it turns into 3 dials.
- (UIView *) pickerView: (UIPickerView *) pickerView viewForRow: (NSInteger) line forComponent: (NSInteger) component reusingView: (UIView *) view {UILabel * pickerLabel = (UILabel *) opinion; CGSize limitSize = CGSizeMake (100.0f, 45.0f); CGSize text size; CGT label label; NSString * title = @ ""; Switch (numberOfComponents) {Case 2: {... the data received is wired by title = someString} Case 3 (varying length from 4 to 20): {... above, but the second set of data As for the same. Title = someString}} textSize = [title sizeWithFont: [UIFont systemFontOfSize: 14] constrainedToSize: LIMITSIZE lineBreakMode: UILineBreakModeWordWrap]; Labeling = CGRactam (0, 0, Textuson.Wide, TextsHight); NSLog (@ "Length:% i Title:% @", [Title Length], Title); NSLog (@ "H:% F w:% F", Text Size., Text, Wise); If (pickerLabel == zero) {pickerLabel = [[[UILabel alloc] initWithFrame: labelRect] autorelease]; [Picker label set font: [UIFont systemFontOfSize: 14]]; [Picker label setbackgram color: [UIColor clearColor]]; [Picker label setline broke mode: UILBrainModwordDrap]; [Selector label settextallement: UITXElmentmentcenter]; [Picker label set offlineNumber: 2]; } [Picker label set text: title]; Return picker label; }
I have manually set the row height to 32.0f. I'm getting very strange results that some of the other components are working perfectly but others Are not wrapping at all, and some are showing just as empty spaces.
i.e.: Brussels Ankur wraps fine (right ingredient). But milk and cream are not displayed (only milk is visible) Vegetables do not appear at all Where am I wrong in my code?
I have been able to deal with it well. I
textSize = [title of title = fonts: [UIFont systemFontOfSize: 14] To constrain the size of the size: border size lineBreak MOD: UILineBreakModeWordWrap];
and I set the frame myself
labelRect = CGRectMake (0,0,100.0,36.0);
Not sure why this work was done during dynamically sizing.
Comments
Post a Comment