Is there any functionality available to do an action sheet in iOS like the image below?
In the examples Declares folder, there is an example project called AlertSheet. Does this do the trick? I attempted to run the project to see if it’s what I’m looking for, but the app crashes in Simulator for me. I also tried copying over the AlertSheet folder from the example to my project, but that made mine crash too.
I also found iOSAlerts in the Declares folder and would use this if the alert sheet does not work, but would rather the sheet over the messagebox style in iOSAlerts example.
I have some private classes in iOSKit that do this. They don’t allow you to add textfields to an Alert right now, but they can definitely do what you picture there. I’ll add them and push an update in a few hours.
Thanks Jason. So the current iOSKit will have an alert sheet? I think I have your most current one. I don’t recall seeing it but will look again. Not needing to include textfields at this time in the sheet.
Side note… I love your work with iOSKit! It brings so many more options to Xojo iOS as still in the infancy stage!
It’s in my private test version right now which contains some unreleased classes. I’ll submit an update later today so they become available, but right now you won’t be able to see them.
Thanks Jason. I looked into this as well before posting. I will use this one if needed, but it seems that iOSAlerts brings up the options in a messagebox style. If I am wrong, please correct me. I’d prefer the slick sheet come up from the bottom, but will use iOSAlerts if needed. Will be waiting to see what Jason K has new in iOSKit
If you call the actionBox method and pass a 0 as the final parameter (style) you’ll get the sheet coming up from the bottom. But be aware that this will crash an iPad as it needs a popover to be called in a different way. So on an iPad you need to always pass in a 1.
Ah…that’s because I didn’t write the code. It’s shipped with Xojo. You only need to read just a little bit further up the thread to see that Dave and save you and I both making additional, redundant posts.
I’m not sure this is true. It works just fine for me without crashing on the iPad simulator, and there is no mention of that in the Apple docs. I wonder if maybe there is a problem with the supplied example if you are seeing a crash?
Jason, thank you for pushing this update through for iOSKit! I apologize for this question, but what items in the kit are needed for the alert sheet? There’s so many! I tried moving over just about everything in the modules folder and some other folders to my project but was getting several errors when trying to run (I think I am using some of your previous classes but not sure which ones and it’s finding duplicate ones). I deleted some of the items I thought were not relevant but still not compiling. I’m guessing there are some declares that are shared.
Not a problem, ask away! I think you will only need the UIKit and Foundation modules, although I haven’t tested to make sure (not at my computer right now). When copying stuff out of iOSKit you just need to copy the Modules folder into your project, everything else is just examples of the classes use and unit tests. Theoretically the only modules that have to be included for any of the other modules are the UIKit and Foundation modules, those are the shared modules referenced by all the others.