ios - UIButton is not appearing inside PopoverView -
i have written code popovermenu , adding 3 uitextfields , 1 uibutton, problem textfields appearing correctly button not appearing. code of function:
- (ibaction)addprofile:(uibarbuttonitem *)sender { uiviewcontroller *popmenu = [[uiviewcontroller alloc] init]; popmenu.contentsizeforviewinpopover = cgsizemake(400, 400); if (_colorpickerpopover == nil) { _colorpickerpopover = [[uipopovercontroller alloc] initwithcontentviewcontroller:popmenu]; uitextfield *name = [[uitextfield alloc] initwithframe:cgrectmake(60, 28, 300, 28)]; name.placeholder = @"company name"; [_colorpickerpopover.contentviewcontroller.view addsubview:name]; uitextfield *angle = [[uitextfield alloc] initwithframe:cgrectmake(60, 108, 300, 28)]; angle.placeholder = @"view angle in deg"; [_colorpickerpopover.contentviewcontroller.view addsubview:angle]; uitextfield *maxdist = [[uitextfield alloc] initwithframe:cgrectmake(60, 188, 300, 28)]; maxdist.placeholder = @"maximum distance in mtrs"; [_colorpickerpopover.contentviewcontroller.view addsubview:maxdist]; uibutton *adddata = [[uibutton alloc] initwithframe:cgrectmake(80, 280, 180, 30)]; int state = uicontrolstatenormal | uicontrolstatehighlighted | uicontrolstatedisabled | uicontrolstateselected; [adddata settitle:@"add profile" forstate:state]; [_colorpickerpopover.contentviewcontroller.view addsubview:adddata]; [_colorpickerpopover presentpopoverfrombarbuttonitem:(uibarbuttonitem *) sender permittedarrowdirections:uipopoverarrowdirectionup animated:yes]; } else { [_colorpickerpopover dismisspopoveranimated:yes]; _colorpickerpopover = nil; } }
Comments
Post a Comment