Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the title of REPickerItem can be changed? #248

Open
ShizhongLi opened this issue Nov 12, 2015 · 9 comments
Open

Is the title of REPickerItem can be changed? #248

ShizhongLi opened this issue Nov 12, 2015 · 9 comments

Comments

@ShizhongLi
Copy link

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
Copy link

are you using swift?

@ShizhongLi
Copy link
Author

Yes, I'm using swift.

@thankmelater23
Copy link

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
Copy link
Author

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
Copy link
Author

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

@thankmelater23
Copy link

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

@ShizhongLi
Copy link
Author

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
Copy link

aasatt commented May 22, 2016

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

@aasatt
Copy link

aasatt commented May 25, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants