2012年4月22日日曜日

quote

photoはある程度目処が付いたので、quoteのviewを作成。とりあえずUITextViewを使う。文字が少ないと質素になるので、文字数とフォントサイズを反比例させた。ひねりの効いた短文などはなかなかインパクトがあってよい。

}else if([[typeArr objectAtIndex:i]isEqualToString:@"quote"]){ //quote
 NSString *text=cont;
 text=[text stringByReplacingOccurrencesOfString:@"<br/>" withString:@"\n"];NSRange r;
 while ((r=[text rangeOfString:@"<[^>]+>" options:NSRegularExpressionSearch]).location!=NSNotFound)
 text=[text stringByReplacingCharactersInRange:r withString:@""];
 UITextView *tv=[[UITextView alloc]initWithFrame:CGRectMake(10, 20, sw-20, sh-20)];
 tv.text=text;tv.font=[UIFont fontWithName:@"Helvetica" size:[text length]>13?300/[text length]*(3-[text length]/150)+15:75];
 tv.textColor=[UIColor blackColor];tv.backgroundColor=[UIColor clearColor];
 tv.editable=NO;
 [postv addSubview:tv];
}

できた。あとは引用符の画像を付けてみる。

0 件のコメント:

コメントを投稿