0

I have around 5 UIViewsin my .xib, inially i am showing only 1 view(view1) which has some labels and button, when i click on button i prompt a systems alertView for granting permission from the setting of the phone and once i get the permission, i am hiding view1 and showing other 4 views using setHidden method, but the view is not refreshing and not showing other 4 views.

-(void) gotPermission 
{ 
    [self->_View2 setHidden:NO]; 
    [self->_View3 setHidden:NO]; 
    [self->_View4 setHidden:NO]; 
    [self->_View1 setHidden:YES]; 
} 
BKjadav
  • 543
  • 2
  • 16
Uzair Dhada
  • 333
  • 2
  • 6
  • 23

1 Answers1

0

Try this. Check for proper connections to the properties, (ie view1 with the view1 in the storyboard or XIB).

-(void)gotPermission{
 self.View2.hidden = NO;
 self.View3.hidden = NO;
 self.View4.hidden = NO;
 self.View1.hidden = YES;
}

Check if views are overlapping on one another, If not check if views are inside one another, if so, all the views should have a similar parent view (eg. self.view)

Saheb Roy
  • 5,899
  • 3
  • 23
  • 35
  • I tried but its not working, still stays on the same `view1` – Uzair Dhada Aug 13 '15 at 13:01
  • are any of your views inside one another? does all the views have a particular view as their parent? – Saheb Roy Aug 13 '15 at 13:02
  • Yes all the views has only one parent view. – Uzair Dhada Aug 13 '15 at 13:03
  • Are all these inside a tableview? – Saheb Roy Aug 13 '15 at 13:11
  • no, there a parent view which 4 view and each view has like view1->view and button view2->tableview view3->toolbar – Uzair Dhada Aug 13 '15 at 13:49
  • can u plz post the picture of the xib or the view controller? – Saheb Roy Aug 14 '15 at 04:49
  • Hi, it seems that it is hiding the `view` and showing another `view` but taking time because of `requestAccessToEntityType for calendar`. Do you why its happening? I mean when i grant the permission the view which should be shown comes very late. – Uzair Dhada Aug 17 '15 at 11:55
  • If you can post a bit more code, i can understand what exactly is going wrong! – Saheb Roy Aug 17 '15 at 12:01
  • When user clicks on a button i call this method `[[CalendarEH sharedInstance] requestPermissionWithEventStore];` then this block is called [self->_sharedEventStore requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) { Which gives error as `Error getting all calendars: Error Domain=EKCADErrorDomain Code=1013 "The operation couldn’t be completed. (EKCADErrorDomain error 1013.)` – Uzair Dhada Aug 17 '15 at 12:04
  • I got the answer, here http://stackoverflow.com/questions/11530050/perform-ui-changes-on-main-thread-using-dispatch-async-or-performselectoronmaint – Uzair Dhada Aug 18 '15 at 10:14
  • Basicallly need to call the method with the use of main thread, which brings the subview to front instantly. – Uzair Dhada Aug 18 '15 at 10:17