0

如果我在作为 xib 文件所有者的头文件中添加此条件编译标志,则 xib 文件无法读取 IBOutlet 并显示为丢失。并发出警告。

在运行时它工作正常。有没有人遇到过同样的问题?

/* MFMessageComposeViewControllerDelegate is available in iOS 4.0 and later. */



#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 40000

   @interface SendMoneyResponseVC : UITableViewController 
    <UINavigationControllerDelegate, MFMessageComposeViewControllerDelegate,    
    MFMailComposeViewControllerDelegate, UIActionSheetDelegate> 

   #else

   @interface SendMoneyResponseVC : UITableViewController 
    <UINavigationControllerDelegate, 
    MFMailComposeViewControllerDelegate, UIActionSheetDelegate> 

    #endif 

{
    IBOutlet UITableView *sendMoneyTableVC;

    IBOutlet UITableViewCell *refNumRemittanceCell;
    IBOutlet UILabel *refNumLabel, *refNumValueLabel, *refNumInfoLabel;

    IBOutlet UITableViewCell *refNumDomesticCell;
    IBOutlet UILabel *domesticInfoLabel, *feeAndReferenceLabel;

    IBOutlet UITableViewCell *shareRefNumCell;
    IBOutlet UIButton *shareRefNumButton;

    NSString *referenceNumber, *recipient, *currency, *mtoName;
    float amount, fee;
    int sendMoneyType;

    UIAlertView *smsAlertView;
}

@property (nonatomic, retain) UITableView *sendMoneyTableVC;

@property (nonatomic, retain) UITableViewCell *refNumRemittanceCell;
@property (nonatomic, retain) UILabel *refNumLabel, *refNumValueLabel, *refNumInfoLabel;

@property (nonatomic, retain) UITableViewCell *refNumDomesticCell;
@property (nonatomic, retain) UILabel *domesticInfoLabel, *feeAndReferenceLabel;

@property (nonatomic, retain) UITableViewCell *shareRefNumCell;
@property (nonatomic, retain) UIButton *shareRefNumButton;

@property (nonatomic, retain) NSString *referenceNumber, *recipient, *currency, *mtoName;
@property float amount, fee;
@property int sendMoneyType;

- (IBAction) didPressShareButton;

@end
4

2 回答 2

1

您是否尝试过以与编译器等效的方式重组代码,但不太可能混淆 Interface Builder?像这样的东西:

@interface SendMoneyResponseVC : UITableViewController 
    <UINavigationControllerDelegate, 
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 40000
    MFMessageComposeViewControllerDelegate,    
#endif 
    MFMailComposeViewControllerDelegate, 
    UIActionSheetDelegate> 
{ ... }
@end

这样就只有一对@interface/@end对。

于 2012-07-13T01:47:14.190 回答
0

这样做的原因是什么?除非您想使用过时的 SDK 进行编译,否则您应该摆脱它。

Interface Builder 不会预处理您的文件,因此它会看到两个@interfaces 和一个@end。
并且界面生成器无法解析这样的东西。

于 2011-02-22T15:11:55.227 回答