romaonthego / RETableViewManager

Powerful data driven content manager for UITableView.
MIT License
2.48k stars 432 forks source link

Is the title of REPickerItem can be changed? #248

Open ShizhongLi opened 8 years ago

ShizhongLi commented 8 years ago

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?

thankmelater23 commented 8 years ago

are you using swift?

ShizhongLi commented 8 years ago

Yes, I'm using swift.

thankmelater23 commented 8 years ago

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

ShizhongLi commented 8 years ago

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 commented 8 years ago

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

thankmelater23 commented 8 years ago

Yea mines is crashing in the RETableViewPickerCell file:

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

ShizhongLi commented 8 years ago

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

aasatt commented 8 years ago

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

aasatt commented 8 years ago

@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"] ]