gpt4 book ai didi

iphone - UIPickerView pickerView :viewForRow:forComponent:reusingView: does not affect below iOS 5. 0

转载 作者:行者123 更新时间:2023-11-29 04:38:07 29 4
gpt4 key购买 nike

我的 UIPickerView 使用 pickerView:viewForRow:forComponent:reusingView: 方法检索其数据。

由于某种原因,该方法不会影响 iOS 4.3 及更低版本。

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
UILabel* label = (UILabel*)view;

if (view == nil) {
label = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease];
}

label.text = @"Text";

return label;
}

最佳答案

这个人做了一个例子,他指出 View 不应该自动释放。 http://alisothegeek.com/2009/07/custom-uipickerview-text-formatting/

关于iphone - UIPickerView pickerView :viewForRow:forComponent:reusingView: does not affect below iOS 5. 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10784691/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com