ios7 - how to add a UITableView into UIAlertView in iOS 7 -
did googling around saw subview no longer supported in ios 7.
some ppl recommend creating custom view, not sure how can that.
here code, can point me in correct direction?
-(ibaction)click_select_fruit_type { select_dialog = [[[uialertview alloc] init] retain]; [select_dialog setdelegate:self]; [select_dialog settitle:@"fruit type"]; [select_dialog setmessage:@"\n\n\n\n"]; [select_dialog addbuttonwithtitle:@"cancel"]; idtype_table = [[uitableview alloc]initwithframe:cgrectmake(20, 45, 245, 90)]; idtype_table.delegate = self; idtype_table.datasource = self; [select_dialog addsubview:idtype_table]; [idtype_table reloaddata]; [select_dialog show]; [select_dialog release]; }
you can change accessoryview own customcontentview in standard alert view in ios7
[alertview setvalue:customcontentview forkey:@"accessoryview"];
note must call before [alertview show].
simplest illustrating example:
uialertview *av = [[uialertview alloc] initwithtitle:@"test" message:@"subview" delegate:nil cancelbuttontitle:@"no" otherbuttontitles:@"yes", nil]; uiview *v = [[uiview alloc] initwithframe:cgrectmake(0, 0, 100, 50)]; v.backgroundcolor = [uicolor yellowcolor]; [av setvalue:v forkey:@"accessoryview"]; [av show];
real tableview subview of uialertview example:
Comments
Post a Comment