私のアプリでは、 のUIButton
中に複数を追加したいのですがUITextView
、今はUIButton
単一のオブジェクトを使用して追加していますが、変更を変更UIButton
して all に適用しますUIButton
。どうすれば解決できますか?
-(void)Check
{
CGPoint origin = note.frame.origin;
NSString* head = [note.text substringToIndex:note.selectedRange.location];
CGSize initialSize = [head sizeWithFont:note.font constrainedToSize:note.contentSize];
NSUInteger startOfLine = [head length];
NSString* tail = [head substringFromIndex:startOfLine];
CGSize lineSize = [tail sizeWithFont:note.font forWidth:note.contentSize.width lineBreakMode:UILineBreakModeWordWrap];
CGPoint cursor = origin;
cursor.x += lineSize.width+15;
cursor.y += initialSize.height - lineSize.height-130;
myButton=[UIButton buttonWithType:UIButtonTypeCustom];
myButton.frame=CGRectMake(cursor.x, cursor.y, 15, 15);
Chkimg = [UIImage imageNamed:@"unchk.png"];
[myButton setBackgroundImage:Chkimg forState:UIControlStateNormal];
[myButton addTarget:self action:@selector(ChcK) forControlEvents:UIControlEventTouchUpInside];
[note addSubview:myButton];
}