正如标题状态,它是在所有可能的地方省略号(...)在一个UIPickerView“行”,而不是结束的beggining?iPhone Pickerview省略号在开始,而不是结束
我都尝试返回的NSString和一个UIView:
pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
我甚至尝试包裹带滚轮的观点,试图找到替代解决方案,我想要的东西,但似乎省略号在beggining仍然是最适合我的东西。
文本的末端是一个唯一的标识符,其中,作为可beggining各种对象之间重复,这是为什么该文本的结尾是更重要提示。
这心不是什么即时通讯做,但认为例如与名称和个人的社会安全号码列表中,姓名可以重复,核潜艇不会。
我知道我可以只放置数在beggining,但这个程序是这样乳宁各种平台,与客户真正想要的号码留底,以保持一致性。
这甚至可能吗?如果是这样,我该怎么做?
感谢名单,斯特凡诺。
答案代码添加:在您UIPickerViewDelegate而不是-pickerView方法:titleForRow:forComponent:方法viewForRow:forComponent:reusingView
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row
forComponent:(NSInteger)component reusingView:(UIView *)view {
UILabel *retval = (id)view;
if (!retval) {
retval= [[[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [pickerView rowSizeForComponent:component].width, [pickerView rowSizeForComponent:component].height)] autorelease];
}
retval.text = [self.arrayWithData objectAtIndex:row];
retval.lineBreakMode = UILineBreakModeHeadTruncation;
retval.backgroundColor = [UIColor clearColor];
return retval;
}
非常感谢,完美的工作。给我的问题添加了详细的答案代码给需要将来参考的人。 – blindstuff 2010-11-09 23:53:57