Skip to content

RPTokenControl is not always initialised correctly #5

@crispinb

Description

@crispinb

If RPTokenControl is created in IB by editing the Custom Class field in an NSView subclass that isn't substituted with an NSCustomView, it won't get initialised properly. In this kind of case, -initWithCoder: is called instead of -initWithFrame:, but initWithCoder isn't implemented.

This can happen, for example, by following these steps:

  • drag an NSScrollView object onto an IB NSView canvas
  • expand the Scroll View document outline (results in Bordered Scroll View -> Clip View -> View)
  • edit the Custom Class field of the above leaf view to be RPTokenControl

This ends up looking exactly like the setup of the RPTokenControl demo app, but the latter somehow ends up with an NSCustomControl in the IB file, whereas the above steps don't. There's no visual indicator of this difference in IB, but it's clear from the source XML. I'm not sure how to account for the difference -- my tests are on Xcode 5.1, using the 10.9 SDK.

The solution is presumably to use a common initialise routine to be called from both initWithCoder: and initWithFrame:

I haven't supplied a patch as, being to date primarily an iOS developer, this is slightly unfamiliar territory, and I may have got the wrong end of the stick somewhere (iOS doesn't have the NSCustomView, and all IB objects are initialised with initWithCoder:).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions