Beginning iOS 6 Development - self.statusLabel.text build failure -


it never sign when beginners book has errors related source in third chapter, here beginning ios 6 development apress. working on simple project gives 2 buttons , changes label based on name of button being pressed.

the initial request book use statuslabel.text = plaintext;, failed.

this discussed on thread, modified self.statuslabel.text = plaintext;, didn't resolve issue.

here code:

#import "bidviewcontroller.h"  @implementation bidviewcontroller  - (ibaction)buttonpressed:(uibutton *)sender {      nsstring *title = [sender titleforstate:uicontrolstatenormal];     nsstring *plaintext = [nsstring stringwithformat:@" %@button pressed.", title];     self.statuslabel.text = plaintext;  }   @end 

the error being thrown following: property 'text' not found on object 'uiview *'

i'm guessing stupid, appreciate can give me.

the error spelled out pretty nicely,

property 'text' not found on object 'uiview *'

meaning declared statuslabel uiview. like:

@property (weak, nonatomic) iboutlet uiview *statuslabel; 

when should have been declared uilabel:

@property (weak, nonatomic) iboutlet uilabel *statuslabel; 

it important keep in mind though uilabel inherit uiview, doesn't mean share same properties/methods. in case, uilabel subclass of uiview declares property @property(nonatomic, copy) nsstring *text; not exist in superclass (uiview).


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -