Created
July 23, 2012 16:57
-
-
Save beatinaniwa/3164705 to your computer and use it in GitHub Desktop.
ActionSheet Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AppDelegate | |
| def application(application, didFinishLaunchingWithOptions:launchOptions) | |
| @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) | |
| @viewController = UIViewController.alloc.init | |
| @viewController.navigationItem.rightBarButtonItem = UIBarButtonItem.alloc.initWithBarButtonSystemItem(UIBarButtonSystemItemAction, target:self, action:'tapped:') | |
| @window.rootViewController = UINavigationController.alloc.initWithRootViewController(@viewController) | |
| @window.rootViewController.wantsFullScreenLayout = true | |
| @window.makeKeyAndVisible | |
| true | |
| end | |
| def tapped(sender) | |
| # Failed | |
| actionSheet = UIActionSheet.alloc.initWithTitle("Test", delegate:self, cancelButtonTitle:"Cancel", destructiveButtonTitle:nil, otherButtonTitles:"WRYYY", "View Info") | |
| actionSheet.showInView(@viewController.view) | |
| # Passed | |
| # @actionSheet ||= UIActionSheet.alloc.initWithTitle("Test", delegate:self, cancelButtonTitle:"Cancel", destructiveButtonTitle:nil, otherButtonTitles:"WRYYY", "View Info") | |
| # @actionSheet.showInView(@viewController.view) | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
サポートチケットを投げたところLaurentから返事をもらいました。許可をもらったのでそのまま転載します。これで解決しました。
The crash sometimes happens because the otherButtonTitles argument is supposed to be a nil-terminated list. If nil is not passed, the method will keep scanning the arguments on the stack.
Changing this line
actionSheet = UIActionSheet.alloc.initWithTitle("Test", delegate:self, cancelButtonTitle:"Cancel", destructiveButtonTitle:nil, otherButtonTitles:"WRYYY", "View Info")
to
actionSheet = UIActionSheet.alloc.initWithTitle("Test", delegate:self, cancelButtonTitle:"Cancel", destructiveButtonTitle:nil, otherButtonTitles:"WRYYY", "View Info", nil)
might fix the problem.