Note that there are some explanatory texts on larger screens.

plurals
  1. POGarbled exception when implementing UIPopoverBackgroundView subclass
    primarykey
    data
    text
    <p>I've implemented this class as follows:</p> <pre><code>#import "JKBackgroundView.h" @implementation JKBackgroundView static CGFloat jkArrowBase = 26.0; static CGFloat jkArrowHeight = 16.0; // Background image insets static CGFloat jkBackgroundTopInset = 68.0f; static CGFloat jkBackgroundLeftInset = 16.0f; static CGFloat jkBackgroundBottomInset = 16.0f; static CGFloat jkBackgroundRightInset = 34.0f; // Content view insets static CGFloat jkContentTopInset = 40.0f; static CGFloat jkContentLeftInset = 6.0f; static CGFloat jkContentBottomInset = 8.0f; static CGFloat jkContentRightInset = 7.0f; +(CGFloat)arrowBase { return jkArrowBase; } -(UIPopoverArrowDirection)arrowDirection { return UIPopoverArrowDirectionUp; } -(CGFloat)arrowOffset { return 0.0f; } +(CGFloat)arrowHeight { return jkArrowHeight; } +(UIEdgeInsets)contentViewInsets { return UIEdgeInsetsMake(jkContentTopInset, jkContentLeftInset, jkContentBottomInset, jkContentRightInset); } -(void)drawRect:(CGRect)rect { UIEdgeInsets popoverInsets = UIEdgeInsetsMake(jkBackgroundTopInset, jkBackgroundLeftInset, jkBackgroundBottomInset, jkBackgroundRightInset); UIImage *popoverImage = [[UIImage imageNamed:@"popover_stretchable.png"] resizableImageWithCapInsets:popoverInsets]; [popoverImage drawInRect:rect]; } -(id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor clearColor]; } return self; } -(void)setArrowDirection:(UIPopoverArrowDirection)arrowDirection { // Do nothing } @end </code></pre> <p>I add it to my UIPopoverView (not a subclass) using this code:</p> <pre><code>_logoutPopover.popoverBackgroundViewClass = [JKBackgroundView class]; </code></pre> <p>When I run the project, though, I receive a crazy error message as follows:</p> <blockquote> <p><em>*</em> Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIPopoverBackgroundView º¯lå] must be implemented by subclassers.'</p> </blockquote> <p>Does anyone has any idea what method it thinks I didn't implement? It appears to just be a bunch of gibberish. Thanks!</p> <p><strong>Edit</strong> It looks like I forgot to implement setArrowOffset:. It works after adding that. Apple's error message was just garbled.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload