iphone - Trying to display an image and label when making a selection from the UIPicker -


please bare me. new @ this.

i have array geek names , array careers of each geek. geek names should appear in uipicker. when name selected, image , career of selected player should displayed @ bottom of picker. unable place images in array _imageview = @[@".... because every time attempt screen goes black. when delete it, runs crashes right after opens on device , following message:

2013-05-02 13:40:03.761 assignment5[2968:c07] -[uiview numberofcomponentsinpickerview:]: unrecognized selector sent instance 0x7549d30 2013-05-02 13:40:03.780 assignment5[2968:c07] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[uiview numberofcomponentsinpickerview:]: unrecognized selector sent instance 0x7549d30' *** first throw call stack: (0x1c92012 0x10cfe7e 0x1d1d4bd 0x1c81bbc 0x1c8194e 0xc634 0xd25f 0x642dd 0x10e36b0 0x228efc0 0x228333c 0x228eeaf 0x1032bd 0x4bb56 0x4a66f 0x4a589 0x497e4 0x4961e 0x4a3d9 0x4d2d2 0xf799c 0x44574 0x4476f 0x44905 0x4d917 0x1196c 0x1294b 0x23cb5 0x24beb 0x16698 0x1beddf9 0x1bedad0 0x1c07bf5 0x1c07962 0x1c38bb6 0x1c37f44 0x1c37e1b 0x1217a 0x13ffc 0x1e9d 0x1dc5) libc++abi.dylib: terminate called throwing exception 

here code:

viewcontroller.h

#import <uikit/uikit.h>  @interface assignment5viewcontroller : uiviewcontroller <uipickerviewdelegate, uipickerviewdatasource> @property (strong, nonatomic) iboutlet uipickerview *picker; @property (strong, nonatomic) iboutlet uilabel *career; @property (strong, nonatomic) iboutlet uiimageview *geekimageview;  @property (strong, nonatomic)nsarray *geeknames; @property (strong, nonatomic)nsarray *careernames;  @end 

viewcontroller.m

@interface assignment5viewcontroller ()  @end  @implementation assignment5viewcontroller   - (void)viewdidload {     [super viewdidload];      _geeknames = @[@"alan turing", @"bill gates", @"dennis ritchie", @"james gosling", @"larry wall", @"linus torvalds", @"mark zuckerberg", @"steve jobs", @"tim berners-lee", @"vinton cerf"];      _careernames = @[@"conceived turing machine", @"started microsoft", @"created c , unix", @"created java language", @"created perl language", @"created linux os", @"created facebook", @"started apple", @"created world-wide-web", @"created tcp/ip"]; }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of resources can recreated. }  - (ibaction)textfieldreturn:(id)sender {     [sender resignfirstresponder]; }  #pragma mark #pragma mark pickerview datasource  - (nsinteger)numberofcomponentsinpickerview:(uipickerview *)pickerview {     return 1; }  - (nsinteger)pickerview:(uipickerview *)pickerview numberofrowsincomponent:(nsinteger)component {     return _geeknames.count; }  - (nsstring *)pickerview:(uipickerview *)pickerview titleforrow:(nsinteger)row forcomponent:(nsinteger)component {     return [_geeknames objectatindex:row]; }  #pragma mark - #pragma mark pickerview delegate  -(void)pickerview:(uipickerview *)pickerview didselectrow:(nsinteger)row incomponent:(nsinteger)component {     _careernames = [[nsstring alloc]initwithformat:@"%@", [_geeknames objectatindex:row]];  }    @end 

it looks error, you've set picker's data source uiview rather view controller. how did set data source? did in ib? should delete connection , redo it.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -