ios - Showing a UIProgressView inside or on top of a UINavigationController's UINavigationBar -
i want have uiprogressview show progress on bottom of navigation bar (just when sending imessage or text message in ios 7). need consistently on every table view view of navigation controller. me clear: have add uinavigationcontroller. problem is, it's not possible add uiprogressview uinavigationcontroller. tried out 2 things:
1st tried add uinavigationcontroller's view programmatically. problem position uiprogressview , make when changing device rotation.
the 2nd thing tried add uiprogressview every uitableview, have every view. doesn't good, because not on top of navigation bar beneath it. main reason why didn't 2nd solution because progressviews go , come tableview, don't have static 1 changing ones.
after this, don't have idea this, ask you… have idea how this?
that's how should like:
i found solution:
i made custom uinavigationcontroller , added viewdidload
- (void)viewdidload { [super viewdidload]; // additional setup after loading view. progress = [[uiprogressview alloc] init]; [[self view] addsubview:progress]; uiview *navbar = [self navigationbar]; [[self view] addconstraints:[nslayoutconstraint constraintswithvisualformat:@"v:[navbar]-[progress(2@20)]" options:nslayoutformatdirectionleadingtotrailing metrics:nil views:nsdictionaryofvariablebindings(progress, navbar)]]; [[self view] addconstraints:[nslayoutconstraint constraintswithvisualformat:@"h:|[progress]|" options:nslayoutformatdirectionleadingtotrailing metrics:nil views:nsdictionaryofvariablebindings(progress)]]; [progress settranslatesautoresizingmaskintoconstraints:no]; [progress setprogress:0 animated:no]; }
i created new uiprogressview (i declared in @interface
) added constraints position beneath navigation bar , (this step important:) set translatesautoresizingmaskintoconstraints
no
.
Comments
Post a Comment