gpt4 book ai didi

ios - 从 Uipickerview 中选择数据时,如何在我的 Uilabel 上显示字符串格式?

转载 作者:行者123 更新时间:2023-11-28 22:11:15 25 4
gpt4 key购买 nike

Hi I have one picker view. This picker view from web services came to loading data. This picker view is 2 part. Picker view 1. part is Project name. and Picker view 2. part is Project number. I want to write on my label same picker view is 1. part I want to write on label "A1 Unitesi", and i want to write on label2 "002" but my label on write "DevamEdenProjelerObje:"0xada6fe0">why on my label write
"DevamEdenProjelerObje:"0xada6fe0"> ?` Can you help to me ? How i can on my label write "A1 Unitesi" ?

enter image description here

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
return 2;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{

if (component == 0) {
return [RaporlarList count];
}
return [RaporlarList count];

}

#pragma mark Picker Delegate Methods
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{

if (component == 0) {
eObje = [RaporlarList objectAtIndex:row];
return eObje.ProjeAdii;

}
eObje = [RaporlarList objectAtIndex:row];
return eObje.ProjeNoo;
}

#pragma mark -
#pragma mark PickerView Delegate

-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{

if (component == 0)
{
NSString *resultString = [[NSString alloc] initWithFormat:@"Proje Adı : %@", [RaporlarList objectAtIndex:row]];
lblProjeAdi.text = [NSString stringWithFormat:@"%@", resultString];

}
else
{
NSString *resultString = [[NSString alloc] initWithFormat:@"Proje No: %@", [RaporlarList objectAtIndex:row]];
lblProjeNo.text = resultString;

}

}

最佳答案

我不知道我是否理解得很好,但那不是更好吗?

if (component == 0)
{
NSString *resultString = [[NSString alloc] initWithFormat:@"Proje Adı : %@", [[RaporlarList objectAtIndex:row] ProjeAdii]];
lblProjeAdi.text = [NSString stringWithFormat:@"%@", resultString];

}
else
{
NSString *resultString = [[NSString alloc] initWithFormat:@"Proje No: %@", [[RaporlarList objectAtIndex:row] ProjeNoo]];
lblProjeNo.text = resultString;

}

关于ios - 从 Uipickerview 中选择数据时,如何在我的 Uilabel 上显示字符串格式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22862685/

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