1

in my iOS project i've been re-using the same 3 different types of UI elements:

  • Label
  • input
  • check mark (or X ).

And the logic is the same:

  • when the user is entering text, validate.
  • while validation fails, red check mark,etc.

So, the next obvious stage is to refactor this into one UIView so that I can just drag and drop.

And I want this into a Cocoa pod.

Refactoring the elements into a UIview, etc is not hard. But I'm stuck on putting this logic into a Cocoa Pod. The XIB doesn't load so the subview is empty.

I've added IB_DESIGNABLE to the header file but still no rendering. And exception at runtime.

Suggestions? What can I post to help?

EDIT:

My resource section of the podspec

s.source_files = 'Pod/Classes/**/*'
  s.resources = 'Pod/Assets/**/*'
  s.resource_bundles = {
    'jawbreaker' => ['Pod/Assets/*.png']
  }
cbrulak
  • 15,436
  • 20
  • 61
  • 101

2 Answers2

1

UIView doesnt load XIB file automatically. When you create an UIView class you need something like this: http://eppz.eu/blog/uiview-from-xib-simplest/ .

MyView *view = [Myview loadFromNib];

An if you want use IB_DESIGNABLE remember: https://stackoverflow.com/a/26202160/846780

Community
  • 1
  • 1
Klevison
  • 3,342
  • 2
  • 19
  • 32
0

You might be missing the s.resource_bundle directive, where you specify which NIBs to load.

Rui Peres
  • 25,741
  • 9
  • 87
  • 137