Xcodeを更新しましたが、ストーリーボードでセレクターに接続されているすべてのボタンが突然機能しなくなりました。プログラムでコード化されたすべてのボタンとジェスチャ認識機能が機能します。部分的に、彼らは同じIBActionsを呼び出しています。
私が何をした...
ストーリーボードのビューにボタンとラベルを追加するだけです。View Controller .hで、ラベルにアウトレットを追加し、IBActionを宣言しました。ファイル:
.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (strong, nonatomic) IBOutlet UILabel *myLabel;
-(IBAction)button_pressed:(id)sender;
-(IBAction)swipe_active:(id)sender;
@end
.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize myLabel;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UISwipeGestureRecognizer *swipe_left = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipe_active:)];
swipe_left.direction = UISwipeGestureRecognizerDirectionLeft;
[self.view addGestureRecognizer:swipe_left];
}
-(IBAction)button_pressed:(id)sender{
myLabel.text=@"Button is Running";
}
-(IBAction)swipe_active:(id)sender{
myLabel.text=@"Swipe is Running";
}
@end
そして、ボタンだけでは機能しません。
ストーリーボード: https://i.stack.imgur.com/1hruM.png