2014-04-20 6 views
0

*line이라는 IBAction 버튼이있는 segue 푸시 버튼을 사용하여 viewController의 정보를 다른 하나의 정보로 전달하려고합니다. 그러나이 방법은 NSLog (@ "% @"참조)가 호출되지 않고 있음을 알 수 있습니다. 메서드를 테스트하기 위해 삽입 한 메시지가 표시되지 않습니다. 첫 번째 코드는 viewController입니다.단추를 누를 때 IBAction 메서드가 호출되지 않습니다. 그러나보기 컨트롤러가 푸시되고 있습니다.

DetailController.m 나는 IBAction 방법에 NSLog(@"%@", see);를 삽입 테스트로

#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]; 

// Do any additional setup after loading the 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; 
[email protected]"VIP Remaining :"; 
p.font=labelFont; 
[email protected]"Price :"; 
money.font=myFont; 

deal.font=labelFont; 
[email protected]"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: 
       [email protected]"Action Cancelled"; 
       break; 
      case SLComposeViewControllerResultDone: 
       [email protected]"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 any resources that can be 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 

하지만이 값

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 

이 방법이 왜에 어떤 제안을 주셔서 감사를 반환하지 않습니다 버튼을 눌렀을 때 호출되지 않는다.

+0

실제로'IBAction'이 호출되고 있습니다. 당신이'NSLog'에 null이 반환되는 것을 볼 수 있습니다. 즉,'IBAction line'을 입력한다는 것을 의미합니다. – hyd00

+0

아니요 내가 잘못 말한 것에 사과드립니다 null을 반환한다는 의미는 아니 었습니다 실제로 아무 메시지도 반환하지 않습니다 – user3492592

+0

내 질문을 편집했습니다 – user3492592

답변

1

IBAction이 호출되지 않도록하는 유일한 방법은 단추가 적절하게 연결되어 있지 않은 경우입니다. 연결 관리자에서 다시 확인하십시오.