ios - Customised UIActionSheet -


how can customise uiactionsheet :

enter image description here

also, if customise uiactionsheet, there chance of app getting rejected ?

if want give go. can't guarantee it'll approved apple , honestly, it's not recommended ui , apple hig perspective.

keep in mind uiactionsheet has been deprecated , it's recommended use uialertcontroller preferredstyle of .actionsheet that's example going use.

import uikit  class viewcontroller: uiviewcontroller {      override func viewdidappear(animated: bool) {         super.viewdidappear(animated)          let controller = swiftdemoalertcontroller(title: nil, message: nil, preferredstyle: .actionsheet)         controller.addaction(uialertaction(title: "reset default", style: .destructive, handler: nil))         controller.addaction(uialertaction(title: "save", style: .default, handler: nil))          self.presentviewcontroller(controller, animated: true, completion: nil)     }      override func viewdidload() {         super.viewdidload()         // additional setup after loading view, typically nib.     }      override func didreceivememorywarning() {         super.didreceivememorywarning()         // dispose of resources can recreated.     }   }  class swiftdemoalertcontroller: uialertcontroller, uitableviewdatasource {      private var controller : uitableviewcontroller      override init(nibname nibnameornil: string?, bundle nibbundleornil: nsbundle?) {         controller = uitableviewcontroller(style: .plain)         super.init(nibname: nibnameornil, bundle: nibbundleornil)         controller.tableview.registerclass(uitableviewcell.self, forcellreuseidentifier: "cell")         controller.tableview.datasource = self         controller.tableview.addobserver(self, forkeypath: "contentsize", options: [.initial, .new], context: nil)         self.setvalue(controller, forkey: "contentviewcontroller")     }      override func observevalueforkeypath(keypath: string?, ofobject object: anyobject?, change: [string : anyobject]?, context: unsafemutablepointer<void>) {         guard keypath == "contentsize" else {             return         }          controller.preferredcontentsize = controller.tableview.contentsize     }      required init?(coder adecoder: nscoder) {         fatalerror("init(coder:) has not been implemented")     }      deinit {         controller.tableview.removeobserver(self, forkeypath: "contentsize")     }      func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int {         return 6     }      func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {         let cell = tableview.dequeuereusablecellwithidentifier("cell")!          switch(indexpath.row) {         case 0:             cell.textlabel?.text = "upcoming activities"             let switchview = uiswitch(frame: cgrectzero)             cell.accessoryview = switchview             switchview.seton(true, animated: false)             break         case 1:             cell.textlabel?.text = "past activities"             let switchview = uiswitch(frame: cgrectzero)             cell.accessoryview = switchview             switchview.seton(false, animated: false)             break         case 2:             cell.textlabel?.text = "activities admin"             let switchview = uiswitch(frame: cgrectzero)             cell.accessoryview = switchview             switchview.seton(true, animated: false)             break         case 3:             cell.textlabel?.text = "attending"             let switchview = uiswitch(frame: cgrectzero)             cell.accessoryview = switchview             switchview.seton(true, animated: false)             break         case 4:             cell.textlabel?.text = "declined"             let switchview = uiswitch(frame: cgrectzero)             cell.accessoryview = switchview             switchview.seton(true, animated: false)             break         case 5:             cell.textlabel?.text = "not responded"             let switchview = uiswitch(frame: cgrectzero)             cell.accessoryview = switchview             switchview.seton(true, animated: false)             break         default:             fatalerror()         }          return cell     } } 

demo app


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -