Reputation: 1973
when I add textview on alertview, the scollview is shown on top and behind of it the text is drawn,how to overcome this problem. Here is the code
question updated:
If the set textView.editable = NO; it work's fine but in my case i need to type the text in textview.
UITextView *textView = [[UITextView alloc]initWithFrame:CGRectMake(12, 50, 260, 50)];
[textView setText:@"lashdasjh asdasjdas asdlajsdl adsjajadsd aslj daj sdjasdjasjdlasjd as dlasj d"];
UIAlertView *av = [[UIAlertView alloc]initWithTitle:@"Type Your Message" message:@"\n\n\n\n\n\n" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Send",nil];
av.alertViewStyle = UIAlertViewStyleDefault;
[av addSubview:textView];
[av show];
Upvotes: 4
Views: 5296
Reputation: 39
This doesn't work anymore on IOS7, but using https://github.com/wimagguc/ios-custom-alertview will help you get it done pretty well
Upvotes: 0
Reputation: 1973
Resolved mySelf. Remove the @"\n\n\n\n\n\n"
in message and add @"\n\n\n\n\n\n"
in title
Upvotes: 4
Reputation: 322
replace your code with this code its work fine.
UITextView *textView = [[UITextView alloc]initWithFrame:CGRectMake(12, 50, 260, 100)];
UIAlertView *av = [[UIAlertView alloc]initWithTitle:@"Type Your Message" message:@"\n\n\n\n\n" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Send",nil];
av.alertViewStyle = UIAlertViewStyleDefault;
[av addSubview:textView];
[av show];
Upvotes: -1