RETableViewManager icon indicating copy to clipboard operation
RETableViewManager copied to clipboard

Is the title of REPickerItem can be changed?

Open ShizhongLi opened this issue 9 years ago • 9 comments

I declared a REPickerItem : var infoItemLeftUp: REPickerItem! Then I do some initialization work of the REPickerItem. Then I change the title of the REPickerItem with: self.infoItemLeftUp.title = updatedLeftUpTitleString But the title did't change. Can't the title of REPickerItem be changed? Or I should change the title with another method?

ShizhongLi avatar Nov 12 '15 01:11 ShizhongLi

are you using swift?

thankmelater23 avatar Nov 17 '15 16:11 thankmelater23

Yes, I'm using swift.

ShizhongLi avatar Nov 18 '15 00:11 ShizhongLi

I'm using swift also and i'm not able to use the REPickerItem. If you're able to put in data and it doesn't crash I would love some sample code. It's the last piece of my app im trying to add.

@erinvilair

thankmelater23 avatar Nov 18 '15 01:11 thankmelater23

OK, here's the sample code: @IBOutlet weak var tableViewLeft: UITableView! var infoTableLeft: RETableViewManager! var infoSectionLeft: RETableViewSection! var infoItemLeftUp: REPickerItem!

And in viewDidLoad:

    self.infoTableLeft = RETableViewManager(tableView: self.tableViewLeft)
    self.infoTableLeft.tableView?.scrollEnabled = false
    self.infoTableLeft.tableView?.layer.shadowOpacity = 1
    self.infoTableLeft.tableView?.layer.shadowRadius = 10
    self.infoTableLeft.tableView?.layer.shadowOffset = CGSizeMake(0, 0)
    self.infoTableLeft.tableView?.layer.shadowColor = UIColor.grayColor().CGColor
    self.infoTableLeft.tableView?.clipsToBounds = false
    self.infoTableLeft.style.cellHeight = 100

    self.infoSectionLeft = RETableViewSection()
    self.infoTableLeft.addSection(infoSectionLeft)

    self.infoItemLeftUp = REPickerItem(title: "--:--", value: ["时间"], placeholder: nil, options: [infoOptions])
    self.infoSectionLeft.addItem(infoItemLeftUp)

ShizhongLi avatar Nov 18 '15 02:11 ShizhongLi

Oh, by the way, the infoOptions is: var infoOptions = ["时间", "距离", "速度", "平均速度", "热量燃烧"]

ShizhongLi avatar Nov 18 '15 02:11 ShizhongLi

Yea mines is crashing in the RETableViewPickerCell file:

  • (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {

THIS LINE--->>> return [[self.item.options objectAtIndex:component] count];

}

Error: unrecognized selector sent to instance 0x155837650 -[Swift._NSContiguousString count]: unrecognized selector sent to instance 0x155837650

Idk what i'm doing wrong I would love if I you can possibly help me with it via: email or text if possible. @erinvilair

thankmelater23 avatar Nov 18 '15 03:11 thankmelater23

Sorry man, but it seems not many relative APIs about RETableViewPickerCell given by the author. I haven't use it as well. Can you use REPickerItem instead of RETableViewPickerCell to fulfill your require?

@thankmelater23

ShizhongLi avatar Nov 18 '15 03:11 ShizhongLi

Same issue here. Crashing on the same line. Any solution yet?

aasatt avatar May 22 '16 06:05 aasatt

@thankmelater23 The format for the picker should be and array of arrays. The first array is the different components of the picker with sub array of items.

let options : [AnyObject]! = [ ["Male", "Female"] ]

aasatt avatar May 25 '16 17:05 aasatt