Right now I have this code to show an alert view with a bunch of options for changing the blocks of something, its a basic scheduling app. But the options now go off the screen [see bottom], is there some way to shrink the view. I also looked into doing something with UIPickerview but it didn't look like it would work for the way this is currently set up
private func showChangeBlock() {
let alert = UIAlertController(title: "Block", message: "During what block does this class meet?", preferredStyle: .actionSheet)
// Array of tuples instead of dictionary so that it retains its order
var blockActions: [(id: Block.ID, alert: UIAlertAction)] = []
let handler: (UIAlertAction) -> Void = {
alert in
// Get the tuple with this specific action, and thus its blockId
guard let key = blockActions.filter({ $0.alert === alert }).first?.id else {
return
}
self.course.scheduleBlock = key
self.tableHandler.reload()
self.needsNotificationUpdate()
}
blockActions = [
(.a, UIAlertAction(title: "A Block", style: .default, handler: handler)),
(.b, UIAlertAction(title: "B Block", style: .default, handler: handler)),
(.c, UIAlertAction(title: "C Block", style: .default, handler: handler)),
(.d, UIAlertAction(title: "D Block", style: .default, handler: handler)),
(.e, UIAlertAction(title: "E Block", style: .default, handler: handler)),
(.f, UIAlertAction(title: "F Block", style: .default, handler: handler)),
(.g, UIAlertAction(title: "G Block", style: .default, handler: handler)),
(.x, UIAlertAction(title: "X Block", style: .default, handler: handler)),
(.block1, UIAlertAction(title: "Block 1", style: .default, handler: handler)),
(.block2, UIAlertAction(title: "Block 2", style: .default, handler: handler)),
(.block3, UIAlertAction(title: "Block 3", style: .default, handler: handler)),
(.block4, UIAlertAction(title: "Block 4", style: .default, handler: handler)),
(.activities, UIAlertAction(title: "Activities", style: .default, handler: handler))
]
for (id, action) in blockActions {
if self.course.scheduleBlock == id {
action.setValue(true, forKey: "checked")
}
alert.addAction(action)
}
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
self.present(alert, animated: true)
}