swift - iOS: Large UIAlertController ActionSheet bouncing while scrolling and not showing line separators -


i have two questions long action sheet including 20 options (larger screen height):

question 1. how disable vertical bounces while scrolling?

question 2. how show line separators while scrolling bottom?

missing line separators of question 2:

enter image description here

i using xcode 6.4 , ios 8.4 simulator. 2 issues exist ipad running same code on ios 9.0.2.

i have created action sheet using uialertcontrollerstyle.actionsheet. have added 20 options in action sheet using addaction.

my viewcontroller.swift below:

override func viewdidload() {     super.viewdidload()      let button = uibutton(frame: cgrectmake(50, 60, 200, 20))     button.settitle("press", forstate: uicontrolstate.normal)     button.settitlecolor(uicolor.bluecolor(), forstate: uicontrolstate.normal)     button.addtarget(self, action: "btnpressed:", forcontrolevents: uicontrolevents.touchupinside)     view.addsubview(button) }  func btnpressed(sender: uibutton) {     let controller = uialertcontroller(title: nil, message: nil, preferredstyle: uialertcontrollerstyle.actionsheet)      item in 1...20 {         controller.addaction(uialertaction(title: "option \(item)", style: uialertactionstyle.default, handler: { action in         }))     }     controller.addaction(uialertaction(title: "cancel", style: uialertactionstyle.cancel, handler: nil))      presentviewcontroller(controller, animated: true, completion: nil) } 

for question 1:

is there bounces property can set in uitableview: tableview.bounces = false prevent long action sheets vertical bounces while scrolling?

for question 2:

this different "uiactionsheet not showing separator on last item on ios 7 gm", uses deprecated uiactionsheet in stead of uialertcontroller uialertcontrollerstyle.actionsheet. adding "cancel" option action sheet not seem solution.

if add title or message action sheet or remove "cancel" option it, bottom line separators still missing.

is possible show these missing lines?

if you'd disable scrolling in view (and of subviews), code should work fine you.

- (void)disablebouncinginview:(uiview *)view {     (uiview *subview in view.subviews) {         if ([subview respondstoselector:@selector(setbounces:)]) {             uiscrollview *scrollview = (uiscrollview *)subview;             [scrollview setbounces:no];         }          [self disablebouncinginview];     } } 

and call this:

[self disablebouncinginview:myalertcontroller.view]; 

edit:

i saw question tagged swift, here's same idea in swift:

func disablebouncinginview(view : uiview) {     subview in view.subviews [uiview]  {         if let scrollview = subview as? uiscrollview {             scrollview.bounces = false         }          disablebouncinginview(subview)     } } 

and called this:

        disablebouncinginview(myalertcontroller.view) 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -