-5
- (void)viewDidLoad
{
[super viewDidLoad];
NSMutableArray *imageArray=[[NSMutableArray alloc]initWithObjects:@"pic1.png",@"pic2.png",@"pic3.png",@"pic4.png",nil];
NSMutableArray *username=[[NSMutableArray alloc]initWithObjects:@"A",@"B",@"C",@"D" ,nil];
[self scrollViewAction];
}
-(void)scrollViewAction
{
int x=5,y=0;
for(int i=0;i<[DetailsArray count];i++)
{
UIButton *btn=[[UIButton alloc]init];
[btn setFrame:CGRectMake(x, y, 90, 90)];
UILabel *usernameLabel=[[UILabel alloc]init];
[btn addTarget:self action:@selector(btnClicked)
forControlEvents:UIControlEventTouchUpInside];
btn.tag=i;
image=[UIImage imageWithData:[NSData dataWithContentsOfFile:@"imageArray"]];
if(i==0||i==1||i==2)
{
usernameLabel=[[UILabel alloc]initWithFrame:CGRectMake(x,90,90,10)];
}
else
{
usernameLabel=[[UILabel alloc]initWithFrame:CGRectMake(x,y+90,90,10)];
}
usernameLabel.text=username;
-------------------------------------------------------(here I am getting cant compare
array with string)
usernameLabel.backgroundColor=[UIColor blueColor];
usernameLabel.font=[UIFont systemFontOfSize:12];
[usernameLabel setTextAlignment:UITextAlignmentCenter];
[self.scrollview addSubview:btn];
[self.scrollview addSubview:usernameLabel];
x=x+110;
if((i+1)%3==0)
{
x=5;
y=y+110;//y=y+115;
}
self.scrollview.contentSize= CGSizeMake(320,y+200);
}
}
, 어떤 배열 당신이 사용하려고하는 이유 당신은 문자열 배열을 비교하는? 문자열 배열에서 일치하는 문자열을 찾고 싶습니까? –
예 ... 문자열 배열에서 일치하는 문자열을 찾고 싶습니다. – Jaffer
코드를 올바르게 형식화하여 사람들이주고 받기를 원한다면 코드를 올바르게 형식화해야하며 코드뿐만 아니라 원하는 것을 설명하도록하십시오. 끔찍한 형식의 덤프. – 8vius