UIPickerView is a user interface component available from iOS 2.0 and above. The basic need of UIPickerView is to select any one option from the list of data that are loaded to the picker view. But, by default, only one line of text is allowed to be displayed in a UIPickerView . Today, we will try to add multi-line text to an UIPickerView . To do so, we need to implement the viewForComponent api. - ( UIView *)pickerView:( UIPickerView *)pickerView viewForRow:( NSInteger )row forComponent:( NSInteger )component reusingView:( UIView *)view; In that method, type cast the view parameter to an UILabel. UILabel *pickerLabel = ( UILabel *)view; Update the frame size of the label. CGRect frame = CGRectMake ( 0 , 0 , 265 , 40 ); pickerLabel = [[[ UILabel alloc ] initWithFrame :frame] autorelease ]; Set the properties of the label as per requirement. [pickerLabel setTextAlig...
Comments
Post a Comment