overrIDe func vIEwDIDLoad() { super.vIEwDIDLoad() // Do any additional setup after loading the vIEw,typically from a nib. let keyBoardToolbar = UIToolbar(frame: CGRectMake(0,self.vIEw.frame.size.wIDth,44)) keyBoardToolbar.barStyle = .Default let flexSpaceKeyboardbarbuttonItem = UIbarbuttonItem(barbuttonSystemItem: .FlexibleSpace,target: nil,action: nil) let doneKeyboardbarbuttonItem = UIbarbuttonItem(Title: "Done",style: .Done,target: self,action: nil) let wordKeyboardbarbuttonItem = UIbarbuttonItem(Title: "button 1",style: .Plain,action: nil) var barItems: [UIbarbuttonItem] = [] barItems.append(wordKeyboardbarbuttonItem) barItems.append(flexSpaceKeyboardbarbuttonItem) barItems.append(doneKeyboardbarbuttonItem) keyBoardToolbar.setItems(barItems,animated: true) self.myTV.inputAccessoryVIEw = keyBoardToolbar}
当我转动设备时,UIToolbar变黑了(点击再次查看此GIF)
那么无论如何要修复它?谢谢!
顺便说一句:在模拟器中,我看不到UIToolbar变黑了.
解决方法 通过添加修复:(仍然不清楚导致它的原因)keyBoardToolbar.isTranslucent = falsekeyBoardToolbar.barTintcolor = UIcolor(colorliteralRed: (247/255),green: (247/255),blue: (247/255),Alpha: 1)
(UIcolor(colorliteralRed:(247/255),绿色:(247/255),蓝色:(247/255),Alpha:1)是从here开始的UIToolbar的默认背景颜色)
总结以上是内存溢出为你收集整理的在iOS中旋转时,inputAccessoryView的UIToolbar变黑全部内容,希望文章能够帮你解决在iOS中旋转时,inputAccessoryView的UIToolbar变黑所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)