ios - UINavigationBar in UINavigationController rotations not acting as expected (items shifted up) -
i've been working on set of ios action extensions seem having problem way uinavigationbar being displayed in app if controlled uinavigationcontroller.
the problem, in short navigation bar gets shifted when rotate portrait, landscape, , portrait again. problem exacerbated if rotate way around. wish provide images, cannot given rules of stackoverflow.
regardless, tested using modified action app extension (modified lower target os, silence warning nsextensionactiviationrule, etc), both uinavigationbar embedded in uinavigationcontroller , not embedded, view in actionviewcontroller. when not in uinavigationcontroller, rotations expected, retains white patch around status bar (and navigation bar wider in landscape orientation), when put uinavigationcontroller, bar button items shifted up.
this tested pretty thoroughly in 8.2, , running modified app, looks 1 expect. know going on here? why button shifted when use uinavigationcontroller in 8.3 , not 8.2? can't seem find documentation on change in 8.3 affect it, , no documentation uinavigationcontroller shouldn't used in action extension, etc. appreciated.
here code, if interested, viewcontroller. not particularly enlightening, it's apple gives you:
import uikit import mobilecoreservices class actionviewcontroller: uiviewcontroller { @iboutlet weak var imageview: uiimageview! override func viewdidload() { super.viewdidload() // item[s] we're handling extension context. // example, image , place image view. // replace appropriate type[s] extension supports. var imagefound = false item: anyobject in self.extensioncontext!.inputitems { let inputitem = item as! nsextensionitem provider: anyobject in inputitem.attachments! { let itemprovider = provider as! nsitemprovider if itemprovider.hasitemconformingtotypeidentifier(kuttypeimage string) { // image. we'll load it, place in our image view. weak var weakimageview = self.imageview itemprovider.loaditemfortypeidentifier(kuttypeimage string, options: nil, completionhandler: { (url, error) in let imageurl = url as! nsurl?; if imageurl != nil { nsoperationqueue.mainqueue().addoperationwithblock { if let imageview = weakimageview { let image = uiimage(contentsoffile: imageurl!.path!); imageview.image = image; } } } }) imagefound = true break } } if (imagefound) { // handle 1 image, stop looking more. break } } } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } @ibaction func done() { // return edited content host app. // template doesn't anything, echo passed in items. self.extensioncontext!.completerequestreturningitems(self.extensioncontext!.inputitems, completionhandler: nil) } }
thanks in advance!
Comments
Post a Comment