【发布时间】:2011-12-07 17:57:33
【问题描述】:
您好,我正在尝试通过单击按钮来实现弹出窗口,这是我之前成功完成的操作,但由于某种原因我无法实现。我现在使用的是 iOS 5。
目前为止
-(void)changetablebuttonPressed:(id)sender{
UIButton *button = (UIButton*)sender;
changetableView = [[ChangeTableViewController alloc] initWithNibName:@"ChangeTableViewController" bundle:nil];
changetablePopover = [[UIPopoverController alloc] initWithContentViewController:changetableView];
[changetablePopover presentPopoverFromRect:button.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:TRUE];
}
代码在尝试initWithContentViewController 甚至是直接的init 后会导致 SIGABRT 错误。我检查了changetableView 不为空,所以我很难过!
ChangeTableViewController 中唯一的自定义代码在viewDidLoad 中,是self.contentSizeForViewInPopover = CGSizeMake(320, 144);
任何猜测都将不胜感激。
编辑: 异常没有被打印到控制台(我不认为),这是整个输出,启用了 Zombies:
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 15 16:03:10 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".sharedlibrary apply-load-rules all
Attaching to process 7596.
Catchpoint 2 (throw)Pending breakpoint 1 - "objc_exception_throw" resolved
Catchpoint 2 (exception thrown).(gdb) bt
#0 0x03dc9a4f in __cxa_throw ()
#1 0x01745e15 in objc_exception_throw ()
#2 0x0155ca78 in +[NSException raise:format:arguments:] ()
#3 0x0155c9e9 in +[NSException raise:format:] ()
#4 0x001c7f0d in -[UIViewController _loadViewFromNibNamed:bundle:] ()
#5 0x001c83a9 in -[UIViewController loadView] ()
#6 0x001c85cb in -[UIViewController view] ()
#7 0x00596559 in -[UIPopoverController _transitionFromViewController:toViewController:animated:] ()
#8 0x00593b13 in -[UIPopoverController initWithContentViewController:] ()
#9 0x0000b7f7 in -[DetailViewController changetablebuttonPressed:] (self=0x6a510e0, _cmd=0x18af6, sender=0x6a696f0) at .../DetailViewController.m:385
#10 0x015b5ec9 in -[NSObject performSelector:withObject:withObject:] ()
#11 0x001055c2 in -[UIApplication sendAction:to:from:forEvent:] ()
#12 0x0010555a in -[UIApplication sendAction:toTarget:fromSender:forEvent:] ()
#13 0x001aab76 in -[UIControl sendAction:to:forEvent:] ()
#14 0x001ab03f in -[UIControl(Internal) _sendActionsForEvents:withEvent:] ()
#15 0x001aa2fe in -[UIControl touchesEnded:withEvent:] ()
#16 0x003c3a2a in _UIGestureRecognizerUpdate ()
#17 0x015889ce in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#18 0x0151f670 in __CFRunLoopDoObservers ()
#19 0x014eb4f6 in __CFRunLoopRun ()
#20 0x014eadb4 in CFRunLoopRunSpecific ()
#21 0x014eaccb in CFRunLoopRunInMode ()
#22 0x0149d879 in GSEventRunModal ()
#23 0x0149d93e in GSEventRun ()
#24 0x00102a9b in UIApplicationMain ()
#25 0x00002b42 in main (argc=1, argv=0xbfffed78) at .../main.m:16
#26 0x00002ab5 in start ()
Current language: auto; currently objective-c
(gdb)
【问题讨论】:
-
"任何猜测都将不胜感激" 如果不查看您的崩溃日志,那肯定是猜测。使用崩溃日志更新您的问题。 SIGABRT 没有足够的调试信息。
-
这听起来很荒谬,我刚刚升级到 xcode 4,我不知道在哪里可以找到崩溃信息。它曾经把它全部转储到控制台,但现在什么都没有了。
-
堆栈跟踪是一个好的开始。引发的异常应该打印到控制台。这是什么?
-
启用僵尸对象并再次发布崩溃日志。
-
只是为了确保弹出框内容大小的尺寸看起来很可疑,您正在构建一个 iPad 应用程序,对吗?因为,UIPopoverController 不支持 iPhone。
标签: ios uiviewcontroller initialization uipopovercontroller