慢慢地,但肯定在iphone上獲得這個委託和協議的東西,但我不明白這個錯誤。無法找到協議聲明自定義協議委託iphone
我已經在我的第一個視圖控制器中聲明瞭我的協議。
在第二個視圖控制器中,我嘗試將它添加到頂部,然後將其導入到頭文件中,並且找不到它。看到我的代碼如下。
// SendSMS
#import <UIKit/UIKit.h>
#import "LoginPage.h"
#import "MessageOptions.h"
@protocol SMSProtocol <NSObject>
-(NSString *)postbackType;
@end
@interface SendSMS : UIViewController <UITextViewDelegate, UITextFieldDelegate> {
id<SMSProtocol> delegate;
MessageOptions *messageOptions;
LoginPage *loginPage;
IBOutlet UITextField *phonenumber;
IBOutlet UITextView *smsBody;
IBOutlet UIScrollView *scrollview;
}
@property (nonatomic, retain) id<SMSProtocol> delegate;
-(IBAction)LoadMessageOptions;
@end
然後我的第二個觀點
#import <UIKit/UIKit.h>
#import "SendSMS.h"
@interface ScheduledSMS : UIViewController <SMSProtocol>{
}
-(IBAction)popBack;
@end
什麼是錯誤? – taskinoor
這應該很好...這個代碼似乎沒有問題 –
我有同樣的問題,我只是在導航器中移動文件,錯誤消失了。 –