- (void)mkSinglePostView{
for(int i=[pvArr count];i<[contArr count];i++){
postv=[[UIView alloc]initWithFrame:self.view.bounds];
if([[typeArr objectAtIndex:i]isEqualToString:@"text"]){ //text
NSString *text=[self deltag:[contArr objectAtIndex:i]];
UITextView *textv=[[UITextView alloc]initWithFrame:CGRectMake(10, 20, sw-20, sh-50)];
[postv addSubview:textv];
textv.text=text;
for(int i=16;i<270;i++){
textv.font=sf(i);
if(textv.contentSize.height>sh-50){textv.font=sf(i-1);break;}
}
textv.textColor=[UIColor blackColor];textv.backgroundColor=[UIColor clearColor];textv.editable=NO;
[postv addSubview:textv];
}else if([[typeArr objectAtIndex:i]isEqualToString:@"photo"]){ //photo
Photo *photov=[[Photo alloc]initWithFrame:self.view.bounds photourl:[contArr objectAtIndex:i]];
[postv addSubview:photov];
[photov loadPhoto];
}else if([[typeArr objectAtIndex:i]isEqualToString:@"quote"]){ //quote
UIImage *quoteimg=[UIImage imageNamed:@"quote"];
UIImageView *quoteimgv=[[UIImageView alloc]initWithImage:quoteimg];
[quoteimgv setFrame:CGRectMake(5,-10,50,50)];quoteimgv.alpha=0.7;
[postv addSubview:quoteimgv];
NSString *quote=[self deltag:[contArr objectAtIndex:i]];
UITextView *quotev=[[UITextView alloc]initWithFrame:CGRectMake(25, 40, sw-30, sh-70)];
[postv addSubview:quotev];
//quotev.text=quote;quotev.font=[UIFont fontWithName:@"Helvetica" size:[quote length]>13?300/[quote length]*(3-[quote length]/150)+15:75];
quotev.text=quote;
for(int i=16;i<270;i++){
quotev.font=sf(i);
if(quotev.contentSize.height>sh-70){quotev.font=sf(i-1);break;}
}
quotev.textColor=[UIColor blackColor];quotev.backgroundColor=[UIColor clearColor];quotev.editable=NO;
UIImage *line=[UIImage imageNamed:@"gray"];
UIImageView *linev=[[UIImageView alloc]initWithImage:line];linev.alpha=0.5;[linev setFrame:CGRectMake(15,50,7,quotev.contentSize.height-20)];
[postv addSubview:linev];
}else if([[typeArr objectAtIndex:i]isEqualToString:@"link"]){ //link
Link *link=[[Link alloc]initWithFrame:CGRectMake(10,30,sw-20,sh-80) string:[[contArr objectAtIndex:i]objectAtIndex:0]];
[postv addSubview:link];
NSLog(@"%f",sh-link.origin.y);
UIImage *openlinkimg=[UIImage imageNamed:@"openlink"],*openlinkimg_on=[UIImage imageNamed:@"openlink_on"];
UIButton *open=[UIButton buttonWithType:UIButtonTypeCustom];//move.alpha=0.7;
[open setImage:openlinkimg forState:UIControlStateNormal];[open setImage:openlinkimg_on forState:UIControlStateHighlighted];
[open setFrame:CGRectMake(10,sh-link.origin.y-30,130,23)];
[open addTarget:self action:@selector(openLink) forControlEvents:UIControlEventTouchUpInside];
[postv addSubview:open];
}
できた。appとして方向性が決まってなかったのを是正した感じかな。そんな大層なもんでもないか。
昼は中華そば鐘馗@東三国で中華そばと半ヤキメシ。美味しい。次はTKG試してみよう。
0 件のコメント:
コメントを投稿