uriel
uriel

Reputation: 1248

Can't find Storyboard ID in Identity inspector

I'm trying to find the "Storyboard ID" which should be before Restoration ID in Identity inspector, but I can't find that for any view I've selected. I've tried to open a new project and I still can't find it either.

Identity inspector

I'm using Xcode 5.0.2 developing for iOS-7.

Can you tell me what I'm missing here?

Upvotes: 8

Views: 4701

Answers (3)

crifan
crifan

Reputation: 14328

  • only View Controller has Storyboard ID
    • vs_has_storyboard_id
  • other view (eg: UIButton) no Storyboard ID
    • view_no_storyboard_id

how get id of a normal view (in Storyboard) ?

two method:

use Referencing Outlet = normally is weak reference ~= like pointer in C

eg: add reference for UIButton

in Storyboard -> choose your UIButton -> Right Click UIButton -> Referencing Outlets->New Referencing Outlet -> drag it to ViewController.h -> got notice Insert Outlet -> popup window -> set Name to you want, eg deviceNameBtn -> Connect -> auto generated code into ViewController.h

enter image description here

enter image description here

enter image description here

@property (weak, nonatomic) IBOutlet UIButton *deviceNameBtn;

then in you (Objective-C) code, you can use deviceNameBtn as the ID of UIButton, do whatever you want

use (int type) tag

eg: your UILabel view's tag = 1

uilabel_tag_1

get your view:

UILabel *label = (UILabel *)[self.view viewWithTag:1];

Upvotes: 1

Rinat Khanov
Rinat Khanov

Reputation: 1576

The storyboard ID is a string field that you can use to create new UIViewController (not UIButton or other elements). An example of how to use it can be found here.

Upvotes: 1

Segev
Segev

Reputation: 19303

enter image description here

You are pointing to a UIView or some other object on the StoryBoard. Press the yellow indicator on top of the other objects which is your ViewController

Upvotes: 12

Related Questions