Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/43.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone Sdk:UIPickerView,可以为不同的组件分配不同的字体大小吗?_Iphone_Objective C_Uipickerview_Font Size - Fatal编程技术网

Iphone Sdk:UIPickerView,可以为不同的组件分配不同的字体大小吗?

Iphone Sdk:UIPickerView,可以为不同的组件分配不同的字体大小吗?,iphone,objective-c,uipickerview,font-size,Iphone,Objective C,Uipickerview,Font Size,我只是想知道是否有办法更改uipickerview中行的字体大小 对于特定组件,而不是所有组件。另外,不同的组件仍然必须能够显示不同的内容,而不是相同的内容。 有人能解决这个问题吗?提前谢谢 -(UIView*)pickerView:(UIPickerView*)pickerView视图for行:(NSInteger)行for组件:(NSInteger)组件重用视图:(UIView*)视图 - (UIView *)pickerView:(UIPickerView *)pickerView vie

我只是想知道是否有办法更改uipickerview中行的字体大小 对于特定组件,而不是所有组件。另外,不同的组件仍然必须能够显示不同的内容,而不是相同的内容。 有人能解决这个问题吗?提前谢谢

-(UIView*)pickerView:(UIPickerView*)pickerView视图for行:(NSInteger)行for组件:(NSInteger)组件重用视图:(UIView*)视图
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view 
{
        UILabel *lbl = (UILabel *)view;
        // Reuse the label if possible...
       if ((lbl == nil) || ([lbl class] != [UILabel class])) {
            CGRect frame = CGRectMake(0.0, 0.0, 270, 32.0);
           lbl = [[[UILabel alloc] initWithFrame:frame] autorelease];

                .... do what you like ...

        }   
        lbl.textColor = [UIColor blackColor];
           lbl.text = [self.<yourdata> objectAtIndex:row];
        return lbl; 
}
{ UILabel*lbl=(UILabel*)视图; //如果可能,重复使用标签。。。 if((lbl==nil)| |([lbl类]!=[UILabel类]){ CGRect帧=CGRectMake(0.0,0.0,270,32.0); lbl=[[UILabel alloc]initWithFrame:frame]自动释放]; …做你喜欢做的事。。。 } lbl.textColor=[UIColor blackColor]; lbl.text=[self.objectAtIndex:row]; 返回lbl; }
调用参数告诉您正在设置哪个视图、行和组件。检查它们,仅当行和组件都匹配(比较并使用流控制)时才设置相应的内容。

好的,但是现在如果我设置标签的文本属性,例如,每个组件中都会出现相同的文本…您需要根据委托方法中提供的行获取数据是,但是我只为每个行获取不同的数据,但在不同组件中仍然是相同的数据。。。不是吗?