Home:ALL Converter>UIPicker not displaying data on transition to ios6

UIPicker not displaying data on transition to ios6

Ask Time:2012-10-29T11:39:49         Author:user1776234

Json Formatter

I just updated my project to ios6 and discovered that my UIPicker is no longer displaying the data in it. I really don't know what I could do to make sure that it does again. Any suggestions?

AddRoleTVC.h

#import <UIKit/UIKit.h>

@interface AddRoleTVC : UITableViewController <UIPickerViewDataSource, UIPickerViewDelegate> {

    IBOutlet UIPickerView *pickerView;
    NSMutableArray *arrayColors;
}
@end

AddRoleTVC.m

    #import "AddRoleTVC.h"
    #import "UIAlertView+error.h"
    #import "API.h"
    #include <CommonCrypto/CommonDigest.h>

    @implementation AddRoleTVC



    // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
    - (void)viewDidLoad {
        [super viewDidLoad];

        arrayColors = [[NSMutableArray alloc] init];
        [arrayColors addObject:@"Red"];
        [arrayColors addObject:@"Orange"];
        [arrayColors addObject:@"Yellow"];
        [arrayColors addObject:@"Green"];
        [arrayColors addObject:@"Blue"];
        [arrayColors addObject:@"Indigo"];
        [arrayColors addObject:@"Violet"];
    }
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView {

    return 1;
}

- (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component {

    return [arrayColors count];
}

- (NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {

    return [arrayColors objectAtIndex:row];
}

- (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {

    NSLog(@"Selected Color: %@. Index of selected color: %i", [arrayColors objectAtIndex:row], row);
}


    @end

Author:user1776234,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/13115584/uipicker-not-displaying-data-on-transition-to-ios6
yy