// Call as oStamps =7, uStamps =3 // o = offer u = user
[self drawgrid:oStamps userStamp:uStamps dialog:dialogSTR];
-(void)drawgrid:(int)ostamp userStamp:(int)uStamp dialog:(NSString *)lastDialog
{
int x,y,usCount,columnCounter;
x=20;
y=451; //image size(Stamp Place Holder) + 9px
usCount=0;
columnCounter=0;
for (int i=0; i<=ostamp; i++) {
if (i==ostamp) {
UILabel *lb=[[UILabel alloc]initWithFrame:CGRectMake(x, y, 50, 52)];
lb.text=lastDialog;
lb.numberOfLines=3;
lb.lineBreakMode=UILineBreakModeWordWrap;
lb.font=[UIFont fontWithName:@"Arial" size:10];
lb.textAlignment=UITextAlignmentCenter;
[scrollView addSubview:lb];
}
else
{
if (usCount<uStamp) {
UIImageView *img=[[UIImageView alloc]initWithFrame:CGRectMake(x, y, 50, 52)];
img.image=[UIImage imageNamed:@"banana.png"];
[scrollView addSubview:img];
usCount++;
}
else
{
UIImageView *img=[[UIImageView alloc]initWithFrame:CGRectMake(x, y, 50, 52)];
img.image=[UIImage imageNamed:@"banana2.png"];
[scrollView addSubview:img];
}
columnCounter++;
if (columnCounter==5) {
columnCounter=0;
x=20;
y=y+57;
}
else
{
x=x+57;
}
}
}
NSLog(@"==%d==%d==%@==",ostamp,uStamp,lastDialog);
}
[self drawgrid:oStamps userStamp:uStamps dialog:dialogSTR];
-(void)drawgrid:(int)ostamp userStamp:(int)uStamp dialog:(NSString *)lastDialog
{
int x,y,usCount,columnCounter;
x=20;
y=451; //image size(Stamp Place Holder) + 9px
usCount=0;
columnCounter=0;
for (int i=0; i<=ostamp; i++) {
if (i==ostamp) {
UILabel *lb=[[UILabel alloc]initWithFrame:CGRectMake(x, y, 50, 52)];
lb.text=lastDialog;
lb.numberOfLines=3;
lb.lineBreakMode=UILineBreakModeWordWrap;
lb.font=[UIFont fontWithName:@"Arial" size:10];
lb.textAlignment=UITextAlignmentCenter;
[scrollView addSubview:lb];
}
else
{
if (usCount<uStamp) {
UIImageView *img=[[UIImageView alloc]initWithFrame:CGRectMake(x, y, 50, 52)];
img.image=[UIImage imageNamed:@"banana.png"];
[scrollView addSubview:img];
usCount++;
}
else
{
UIImageView *img=[[UIImageView alloc]initWithFrame:CGRectMake(x, y, 50, 52)];
img.image=[UIImage imageNamed:@"banana2.png"];
[scrollView addSubview:img];
}
columnCounter++;
if (columnCounter==5) {
columnCounter=0;
x=20;
y=y+57;
}
else
{
x=x+57;
}
}
}
NSLog(@"==%d==%d==%@==",ostamp,uStamp,lastDialog);
}
No comments:
Post a Comment