ios - How to Add button or label to iwatch programatically -
i tinkering wkinterface
, apple watch apps , wondering how add subview uibutton
or uilabel
.
it seems
uibutton *whatever = [[uibutton alloc]init]; [self.view addsubview:whatever];
does not work iwatch extension. [self.view addsubview: ]
part doesnt seem work.
does know how add view programatically apple watch or have use interface builder , drag , drop these objects.
you have use interface builder. cannot allocate ui objects yourself.
you create interface objects indirectly adding object storyboard scene , referring interface controller. after adding element storyboard, create outlet in interface controller. during initialization of interface controller, watchos creates interface objects of connected outlets automatically. you never create interface objects yourself.
Comments
Post a Comment