objective c - IBAction Method not being called when button is pushed. But View controller is being pushed -
i attempting pass information 1 viewcontroller
using push segue
ibaction
button named *line
. can tell method not being called , nslog(@"%@", see); inserted test method not displaying message. here code first viewcontroller
.
detailcontroller.m
#import "detailcontroller.h" #import "city.h" #import "viewcontroller.h" #import "videocontroller.h" #import "helper.h" @interface detailcontroller () @property (nonatomic, strong) iboutlet videocontroller *videoviewcontroller; @end @implementation detailcontroller @synthesize city, clubname, price, vip, promo, remain,p,deal,money,camera,tweet,post; - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { // custom initialization } return self; } - (void)viewdidload { self.videoviewcontroller = [[videocontroller alloc] init]; [scroller setscrollenabled:yes]; [scroller setcontentsize:cgsizemake(320,1400)]; [super viewdidload]; uiimage *highlightedbuttonimage = [uiimage imagenamed:@"twitter.png"]; uiimage *highlightedbuttonimage2 = [uiimage imagenamed:@"twitter2.png"]; [helper customizebarbutton:self.tweet image:highlightedbuttonimage highlightedimage:highlightedbuttonimage2]; uiimage *facebuttonimage = [uiimage imagenamed:@"facebook.png"]; uiimage *facebuttonimage2 = [uiimage imagenamed:@"facebook2.png"]; [helper customizebarbutton:self.post image:facebuttonimage highlightedimage:facebuttonimage2]; uiimage *taxibuttonimage = [uiimage imagenamed:@"taxi.png"]; uiimage *taxibuttonimage2 = [uiimage imagenamed:@"taxi2.png"]; [helper customizebarbutton:self.taxi image:taxibuttonimage highlightedimage:taxibuttonimage2]; // additional setup after loading view. uifont *labelfont=[uifont fontwithname:@"king kikapu" size:15.0]; uifont *myfont=[uifont fontwithname:@"deutsch gothic" size:20.0]; uifont *myfont2=[uifont fontwithname:@"deutsch gothic" size:35.0]; uifont *titlefont=[uifont fontwithname:@"pornstar" size:50.0]; nsstring * name= self.city.clubname; nsstring * line= self.city.clubline; nsstring * description= self.city.promo; nsstring * price= self.city.price; nsstring *ipcam= self.city.camera; remain.font=labelfont; remain.text=@"vip remaining :"; p.font=labelfont; p.text=@"price :"; money.font=myfont; deal.font=labelfont; deal.text=@"promotions :"; clubname.font=titlefont; clubname.text=name; vip.font=myfont2; vip.text=line; price.font=myfont2; price.text=price; promo.font=myfont; promo.text=description; } - (ibaction)postfacebook:(id)sender { if ([slcomposeviewcontroller isavailableforservicetype:slservicetypefacebook]) { slcomposeviewcontroller * facebook= [[slcomposeviewcontroller alloc]init]; facebook= [slcomposeviewcontroller composeviewcontrollerforservicetype:slservicetypefacebook]; [facebook setinitialtext:[nsstring stringwithformat:@"i'm heading to"]]; [self presentviewcontroller:facebook animated:yes completion:nil]; [facebook setcompletionhandler:^(slcomposeviewcontrollerresult result){ nsstring * output; switch (result) { case slcomposeviewcontrollerresultcancelled: output=@"action cancelled"; break; case slcomposeviewcontrollerresultdone: output=@"post succesful"; default: break; } uialertview *alert= [[uialertview alloc]initwithtitle:@"facebook" message:output delegate:nil cancelbuttontitle:@"okay" otherbuttontitles:nil, nil]; [alert show]; }]; }} - (ibaction)posttwitter:(id)sender { if([slcomposeviewcontroller isavailableforservicetype:slservicetypetwitter]) { slcomposeviewcontroller *tweetsheet= [slcomposeviewcontroller composeviewcontrollerforservicetype:slservicetypetwitter]; [tweetsheet setinitialtext:@"i'm heading to"]; [self presentviewcontroller: tweetsheet animated:yes completion:nil]; } } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } - (ibaction)line:(id)sender { nsstring *see=self.city.camera; nslog(@"%@", see); uistoryboard* storyboard = [uistoryboard storyboardwithname:@"mainstoryboard" bundle:nil]; self.videoviewcontroller = [storyboard instantiateviewcontrollerwithidentifier:@"page3"]; self.videoviewcontroller.city.camera= self.city.camera; [self.navigationcontroller pushviewcontroller:self.videoviewcontroller animated:yes]; } @end
as test inserted nslog(@"%@", see);
ibaction
method not returning value
detailcontroller.h
#import <uikit/uikit.h> #import "videocontroller.h" #import <social/social.h> @class city; @interface detailcontroller : uiviewcontroller { iboutlet uiscrollview *scroller; } @property (weak, nonatomic) iboutlet uibarbuttonitem *taxi; @property (strong,nonatomic) city *city; @property (weak, nonatomic) iboutlet uilabel *clubname; @property (weak, nonatomic) iboutlet uilabel *vip; @property (weak, nonatomic) iboutlet uilabel *price; @property (nonatomic, strong)nsstring * camera; @property (weak, nonatomic) iboutlet uilabel *promo; @property (weak, nonatomic) iboutlet uilabel *remain; @property (weak, nonatomic) iboutlet uilabel *p; @property (weak, nonatomic) iboutlet uilabel *deal; @property (weak, nonatomic) iboutlet uilabel *money; @property (weak, nonatomic) iboutlet uibarbuttonitem *tweet; @property (weak, nonatomic) iboutlet uibarbuttonitem *post; - (ibaction)line:(id)sender; @end
thanks suggestions on why method not being called when button pushed
the way ibaction not called when button not appropriately connected it. double check in connections inspector.
Comments
Post a Comment