开发者

Creating textViews on Button click

开发者 https://www.devze.com 2023-04-12 22:57 出处:网络
I have a UIButto开发者_Python百科n in UIViewController, i want add to dynamic number of UITextViews in the ViewController on this button click action. After creating textviews i am moving it using tou

I have a UIButto开发者_Python百科n in UIViewController, i want add to dynamic number of UITextViews in the ViewController on this button click action. After creating textviews i am moving it using touches, but as i create a new textview the previous textview does not respond to touch event.Why is this happening? here is my code:

    -(IBAction)createTextView{

       UITextView *textView =[[UITextView alloc]init];
       textView.frame=CGRectMake(40,40,10,300);
       [self.view addSubview:textView];
     }      


Use textView.delegate=self; after allocating the textView. Hope it will work fine once its done.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号