每次我单击UITextView按钮都会创建一个ADD。每次我单击Y-axis时,都会更改ADD值(例如,y + = 100),因此会在另一个UITextViews下方创建一组UITextViews。我无法弄清楚如何区分和访问特定的UITextView。谢谢你的帮助!

编辑:

-(IBAction)access:(id)sender
{
     int tg=[sender superview].tag;
     UIView *view=(UIView *)[textView viewWithTag:tg-1];
}


tg-1,因为我试图访问以前的UITextView,当我这样做时,它返回NULL。

最佳答案

将它们存储在NSMutableArray上:
 NSMutableArray * views = [[NSMutableArray alloc] init]

您的IBAction

-(IBAction)access:(id)sender{ int tg=[sender superview].tag; UIView *view=(UIView *)[textView viewWithTag:tg-1]; [views addObject: views];}

然后,您可以获得具有整数索引的所有引用,其中包括:

UIView * storedView = [views objectAtIndex: 1];

10-07 19:14
查看更多