UIButton
在我的应用程序中,我喜欢在 a中添加多个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];
}