ios - UIPickerView is not working -


i have question how use uipickerview. have 2 vc connected between push segue, in 1 put uipickerview 5 names of colours , in other have tableview, question is, want change colour on cell background when select pickerview, down here have code how tried do. please if have idea how glad. in advance!!!!

-(void)pickerview:(uipickerview *)pickerview didselectrow:(nsinteger)row incomponent:(nsinteger)component  {     switch (row) {         case 0:             self.color.text = @"blue #0000ff";             self.table.vi.backgroundcolor= [uicolor colorwithred:0.0f/255.0f green: 0.0f/255.0f blue:255.0f/255.0f alpha:255.0f/255.0f];             break;         case 1:             self.color.text = @"green #00ff00";             self.view.backgroundcolor = [uicolor colorwithred:0.0f/255.0f green: 255.0f/255.0f blue:0.0f/255.0f alpha:255.0f/255.0f];             break;         case 2:             self.color.text = @"orange #ff681f";             self.view.backgroundcolor = [uicolor colorwithred:205.0f/255.0f green:   140.0f/255.0f blue:31.0f/255.0f alpha:255.0f/255.0f];             break;         case 3:             self.color.text = @"purple #ff00ff";             self.view.backgroundcolor = [uicolor colorwithred:255.0f/255.0f green:   0.0f/255.0f blue:255.0f/255.0f alpha:255.0f/255.0f];             break;         case 4:             self.color.text = @"red #ff0000";             self.view.backgroundcolor = [uicolor colorwithred:255.0f/255.0f green:   0.0f/255.0f blue:0.0f/255.0f alpha:255.0f/255.0f];             break;         case 5:             self.color.text = @"yellow #ffff00";             self.view.backgroundcolor = [uicolor colorwithred:255.0f/255.0f green:   255.0f/255.0f blue:0.0f/255.0f alpha:255.0f/255.0f];             break; } 

and code tableview try change backgroundcolor:

-(void)tableview:(uitableview *)tableview willdisplaycell:(uitableviewcell *)cell forrowatindexpath:(nsindexpath *)indexpath  {     self.vi = [[uiview alloc] init];     [cell setbackgroundview:self.vi]; } 

the problem when try change backgroundcolor on same vc pickerview is, working, when try pass in class not working. please help!!!

after few days solved problem. best way send values between 2 classes via nsuserdefaults.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -