8

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?

uriel
  • 1,209
  • 1
  • 16
  • 26

3 Answers3

12

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

Segev
  • 19,035
  • 12
  • 80
  • 152
  • So it's not possible to get a specific view by some uniqe ID? (I though each view has a storyboard ID). – uriel Jan 06 '14 at 07:19
  • 1
    @uriel only `ViewControllers` get a storyboard ID. For what you're asking you can use the `tag` property. – Segev Jan 06 '14 at 07:20
1

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.

Community
  • 1
  • 1
Rinat Khanov
  • 1,566
  • 10
  • 32
0
  • 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];
crifan
  • 12,947
  • 1
  • 71
  • 56