Tuesday, 15 January 2013

ios - UIPickerView is not working -


I have a question about using UIPickerView. I have 2 VC, which is connected between Push Segue, in one I have put a UIPRView with the colors of 5 names and in the second I have a table view, I have a question, I change the color on the cell background Pick me up when I pick it from PickView, here I have a code below which I tried to do. Please if someone knows how I am so happy I am. thank you in advanced !!!!

  - (zero) pickerView: (UIPickerView *) was selected pickerView: component in NSInteger line: (NSInteger) component {switch (line) {case 0: self .color. Text = @ "Blue # 0000ff"; Self.table.vi.backgroundColor = [UIColor colorWithRed: 0.0f / 255.0f green: 0.0f / 255.0f blue: 255.0 f / 255.0f alpha: 255.0 f / 255.0 f]; break; Case 1: self.color.text = @ "Green # 00FF00"; Self.view.backgroundColor = [UIColor colorWithRed: 0.0f / 255.0f Green: 255.0 F / 255.0F blue: 0.0 F / 255.0F Alpha: 255.0F / 255.0F]; break; Case 2: self.color.text = @ "Orange # FF 681F"; 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 #FFFFF"; Self.view.backgroundColor = [UIColor colorWithRed: 255.0 f / 255.0f green: 0.0f / 255.0f blue: 255.0 f / 255.0f alpha: 255.0 f / 255.0 f]; break; Case 4: self.color.text = @ "Red # FF 20000"; Self.view.backgroundColor = [UIColor colorWithRed: 255.0 f / 255.0f green: 0.0f / 255.0f blue: 0.0 f / 255.0f alpha: 255.0 f / 255.0 f]; break; Case 5: self.color.text = @ "Yellow #FFFF0000"; Self.view.backgroundColor = [UIColor colorWithRed: 255.0f / 255.0f Green: 255.0 f / 255.0 f blue: 0.0 f / 255.0f alpha: 255.0 f / 255.0 f]; break; }  

and code from the table view, where I try to change the background:

 - (zero) tableview: (UITableView *) tableView willDisplayCell : (UITableViewCell *) RowAtIndexPath for cell: (NSIndexPath *) indexPath {self.vi = [[UIView alloc] init]; [Cell setbackground view: self V]; }  

The problem is that when I try to change the background color on the same VC where pickup is done, everything works, but when I pass it in another class If I try, it does not work. Please help!

After a few days, I resolved this problem. The best way to send values ​​between 2 classes is through NSUserDefaults


No comments:

Post a Comment