Objective c 如何编辑在interface.storyboard中创建的新界面?

Objective c 如何编辑在interface.storyboard中创建的新界面?,objective-c,watchkit,watchos-2,watchos,Objective C,Watchkit,Watchos 2,Watchos,我在interface.storyboard(属于watchOS的界面)中创建了新的界面,现在想对一些按钮和标签进行编程,这些按钮和标签具有新的界面,但不知道如何实现。当我在Xcode中打开接口控制器类时,它不允许我编辑控制器。出现以下消息: 无法解锁文件“WKInterfaceController.h” 这是接口控制器代码: // WKInterfaceController.h // WatchKit // // Copyright (c) 2014-2015 Apple Inc. Al

我在interface.storyboard(属于watchOS的界面)中创建了新的界面,现在想对一些按钮和标签进行编程,这些按钮和标签具有新的界面,但不知道如何实现。当我在Xcode中打开接口控制器类时,它不允许我编辑控制器。出现以下消息:

无法解锁文件“WKInterfaceController.h”

这是接口控制器代码:

//  WKInterfaceController.h
//  WatchKit
//
//  Copyright (c) 2014-2015 Apple Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
#import <WatchKit/WKDefines.h>

NS_ASSUME_NONNULL_BEGIN

@class WKAlertAction;
@class WKInterfaceTable;
@class WKInterfacePicker;
@class UIImage;
@class UILocalNotification;
@class PKPass;

typedef NS_ENUM(NSInteger, WKUserNotificationInterfaceType)  {
    WKUserNotificationInterfaceTypeDefault,
    WKUserNotificationInterfaceTypeCustom,
} NS_ENUM_AVAILABLE_IOS(8_2);

typedef NS_ENUM(NSInteger, WKMenuItemIcon)  {
    WKMenuItemIconAccept,       // checkmark
    WKMenuItemIconAdd,          // '+'
    WKMenuItemIconBlock,        // circle w/ slash
    WKMenuItemIconDecline,      // 'x'
    WKMenuItemIconInfo,         // 'i'
    WKMenuItemIconMaybe,        // '?'
    WKMenuItemIconMore,         // '...'
    WKMenuItemIconMute,         // speaker w/ slash
    WKMenuItemIconPause,        // pause button
    WKMenuItemIconPlay,         // play button
    WKMenuItemIconRepeat,       // looping arrows
    WKMenuItemIconResume,       // circular arrow
    WKMenuItemIconShare,        // share icon
    WKMenuItemIconShuffle,      // swapped arrows
    WKMenuItemIconSpeaker,      // speaker icon
    WKMenuItemIconTrash,        // trash icon
} NS_ENUM_AVAILABLE_IOS(8_2);

typedef NS_ENUM(NSInteger, WKTextInputMode)  {
    WKTextInputModePlain,       // text (no emoji) from dictation + suggestions
    WKTextInputModeAllowEmoji,      // text plus non-animated emoji from dictation + suggestions
    WKTextInputModeAllowAnimatedEmoji,  // all text, animated emoji (GIF data)
};

typedef NS_ENUM(NSInteger, WKAlertControllerStyle) {
    WKAlertControllerStyleAlert,
    WKAlertControllerStyleSideBySideButtonsAlert,
    WKAlertControllerStyleActionSheet,
} WK_AVAILABLE_WATCHOS_ONLY(2.0);


typedef NS_ENUM(NSInteger, WKVideoGravity)  {
    WKVideoGravityResizeAspect,
    WKVideoGravityResizeAspectFill,
    WKVideoGravityResize
} WK_AVAILABLE_WATCHOS_ONLY(2.0);

/*
 The following presets can be specified to indicate the desired output sample rate. The resulting bit rate depends on the preset and the audio format. The audio file type is inferred from the output URL extension. The audio format is inferred from the audio file type. Supported file types include .wav, .mp4, and .m4a. When the URL extension is .wav, the audio format is LPCM. It is AAC for all other cases.
 */
typedef NS_ENUM(NSInteger, WKAudioRecorderPreset) {
    WKAudioRecorderPresetNarrowBandSpeech,  // @8kHz, LPCM 128kbps, AAC 24kbps
    WKAudioRecorderPresetWideBandSpeech,    // @16kHz, LPCM 256kbps, AAC 32kbps
    WKAudioRecorderPresetHighQualityAudio   // @44.1kHz, LPCM 705.6kbps, AAC 96kbps
} WK_AVAILABLE_WATCHOS_ONLY(2.0);

WK_CLASS_AVAILABLE_IOS(8_2)
@interface WKInterfaceController : NSObject

- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (void)awakeWithContext:(nullable id)context;   // context from controller that did push or modal presentation. default does nothing

@property (nonatomic, readonly) CGRect contentFrame;

- (void)willActivate;      // Called when watch interface is active and able to be updated. Can be called when interface is not visible.
- (void)didDeactivate;     // Called when watch interface is no longer active and cannot be updated.

- (void)didAppear WK_AVAILABLE_WATCHOS_ONLY(2.0);  // Called when watch interface is visible to user
- (void)willDisappear WK_AVAILABLE_WATCHOS_ONLY(2.0); // Called when watch interface is about to no longer be visible

- (void)pickerDidFocus:(WKInterfacePicker *)picker WK_AVAILABLE_WATCHOS_ONLY(2.0);
- (void)pickerDidResignFocus:(WKInterfacePicker *)picker WK_AVAILABLE_WATCHOS_ONLY(2.0);
- (void)pickerDidSettle:(WKInterfacePicker *)picker WK_AVAILABLE_WATCHOS_ONLY(2.0);

- (void)table:(WKInterfaceTable *)table didSelectRowAtIndex:(NSInteger)rowIndex;  // row selection if controller has WKInterfaceTable property
- (void)handleActionWithIdentifier:(nullable NSString *)identifier forRemoteNotification:(NSDictionary *)remoteNotification; // when the app is launched from a notification. If launched from app icon in notification UI, identifier will be empty
- (void)handleActionWithIdentifier:(nullable NSString *)identifier forLocalNotification:(UILocalNotification *)localNotification; // when the app is launched from a notification. If launched from app icon in notification UI, identifier will be empty
- (void)handleUserActivity:(nullable NSDictionary *)userInfo; // called on root controller(s) with user info

- (void)setTitle:(nullable NSString *)title;        // title of controller. displayed when controller active

- (void)pushControllerWithName:(NSString *)name context:(nullable id)context;  // context passed to child controller via initWithContext:
- (void)popController;
- (void)popToRootController;

+ (void)reloadRootControllersWithNames:(NSArray<NSString*> *)names contexts:(nullable NSArray *)contexts;
- (void)becomeCurrentPage;

- (void)presentControllerWithName:(NSString *)name context:(nullable id)context; // modal presentation
- (void)presentControllerWithNames:(NSArray<NSString*> *)names contexts:(nullable NSArray *)contexts; // modal presentation of paged controllers. contexts matched to controllers
- (void)dismissController;

- (void)presentTextInputControllerWithSuggestions:(nullable NSArray<NSString*> *)suggestions allowedInputMode:(WKTextInputMode)inputMode completion:(void(^)(NSArray * __nullable results))completion; // results is nil if cancelled
- (void)presentTextInputControllerWithSuggestionsForLanguage:(NSArray * __nullable (^ __nullable)(NSString *inputLanguage))suggestionsHandler allowedInputMode:(WKTextInputMode)inputMode completion:(void(^)(NSArray * __nullable results))completion;
- (void)dismissTextInputController;

WKI_EXTERN NSString *const UIUserNotificationActionResponseTypedTextKey WK_AVAILABLE_WATCHOS_ONLY(2.0);

WKI_EXTERN NSString *const WKMediaPlayerControllerOptionsAutoplayKey WK_AVAILABLE_WATCHOS_ONLY(2.0);      // NSNumber containing BOOL
WKI_EXTERN NSString *const WKMediaPlayerControllerOptionsStartTimeKey WK_AVAILABLE_WATCHOS_ONLY(2.0);     // NSNumber containing NSTimeInterval
WKI_EXTERN NSString *const WKMediaPlayerControllerOptionsVideoGravityKey WK_AVAILABLE_WATCHOS_ONLY(2.0);  // NSNumber containing WKVideoGravity
WKI_EXTERN NSString *const WKMediaPlayerControllerOptionsLoopsKey WK_AVAILABLE_WATCHOS_ONLY(2.0);         // NSNumber containing BOOL

- (void)presentMediaPlayerControllerWithURL:(NSURL *)URL options:(nullable NSDictionary *)options completion:(void(^)(BOOL didPlayToEnd, NSTimeInterval endTime, NSError * __nullable error))completion WK_AVAILABLE_WATCHOS_ONLY(2.0);
- (void)dismissMediaPlayerController WK_AVAILABLE_WATCHOS_ONLY(2.0);

WKI_EXTERN NSString *const WKAudioRecorderControllerOptionsActionTitleKey WK_AVAILABLE_WATCHOS_ONLY(2.0);           // NSString (default is "Save")
WKI_EXTERN NSString *const WKAudioRecorderControllerOptionsAlwaysShowActionTitleKey WK_AVAILABLE_WATCHOS_ONLY(2.0); // NSNumber containing BOOL (default is NO)
WKI_EXTERN NSString *const WKAudioRecorderControllerOptionsAutorecordKey WK_AVAILABLE_WATCHOS_ONLY(2.0);            // NSNumber containing BOOL (default is YES)
WKI_EXTERN NSString *const WKAudioRecorderControllerOptionsMaximumDurationKey WK_AVAILABLE_WATCHOS_ONLY(2.0);       // NSNumber containing NSTimeInterval

- (void)presentAudioRecorderControllerWithOutputURL:(NSURL *)URL preset:(WKAudioRecorderPreset)preset options:(nullable NSDictionary *)options completion:(void (^)(BOOL didSave, NSError * __nullable error))completion WK_AVAILABLE_WATCHOS_ONLY(2.0);
- (void)dismissAudioRecorderController WK_AVAILABLE_WATCHOS_ONLY(2.0);

- (nullable id)contextForSegueWithIdentifier:(NSString *)segueIdentifier;
- (nullable NSArray *)contextsForSegueWithIdentifier:(NSString *)segueIdentifier;
- (nullable id)contextForSegueWithIdentifier:(NSString *)segueIdentifier inTable:(WKInterfaceTable *)table rowIndex:(NSInteger)rowIndex;
- (nullable NSArray *)contextsForSegueWithIdentifier:(NSString *)segueIdentifier inTable:(WKInterfaceTable *)table rowIndex:(NSInteger)rowIndex;

- (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations WK_AVAILABLE_WATCHOS_ONLY(2.0);

- (void)presentAlertControllerWithTitle:(nullable NSString *)title message:(nullable NSString *)message preferredStyle:(WKAlertControllerStyle)preferredStyle actions:(NSArray <WKAlertAction *>*)actions WK_AVAILABLE_WATCHOS_ONLY(2.0);

- (void)presentAddPassesControllerWithPasses:(NSArray <PKPass *> *)passes completion:(void(^)(void))completion WK_AVAILABLE_WATCHOS_ONLY(2.0);
- (void)dismissAddPassesController WK_AVAILABLE_WATCHOS_ONLY(2.0);

- (void)addMenuItemWithImage:(UIImage *)image title:(NSString *)title action:(
 SEL)action;           // all parameters must be non-nil
- (void)addMenuItemWithImageNamed:(NSString *)imageName title:(NSString *)title action:(SEL)action;
- (void)addMenuItemWithItemIcon:(WKMenuItemIcon)itemIcon title:(NSString *)title action:(SEL)action;
- (void)clearAllMenuItems;

- (void)updateUserActivity:(NSString *)type userInfo:(nullable NSDictionary *)userInfo webpageURL:(nullable NSURL *)webpageURL;  // provide type and info to Handoff. userInfo and webpageUrl are passed to the application receiving the Handoff
- (void)invalidateUserActivity;

+ (BOOL)openParentApplication:(NSDictionary *)userInfo reply:(nullable void(^)(NSDictionary * replyInfo, NSError * __nullable error)) reply WK_AVAILABLE_IOS_ONLY(8.2);    // launches containing iOS application on the phone. userInfo must be non-nil

- (void)beginGlanceUpdates WK_AVAILABLE_WATCHOS_ONLY(2.0);
- (void)endGlanceUpdates WK_AVAILABLE_WATCHOS_ONLY(2.0);

@end

WK_CLASS_AVAILABLE_IOS(8_2)
@interface WKUserNotificationInterfaceController : WKInterfaceController

- (instancetype)init NS_DESIGNATED_INITIALIZER;

- (void)didReceiveRemoteNotification:(NSDictionary *)remoteNotification withCompletion:(void(^)(WKUserNotificationInterfaceType interface)) completionHandler;
- (void)didReceiveLocalNotification:(UILocalNotification *)localNotification withCompletion:(void(^)(WKUserNotificationInterfaceType interface)) completionHandler;

// Subclasses can implement to return an array of suggestions to use as text responses to a remote notification.
- (nonnull NSArray<NSString *> *)suggestionsForResponseToActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)remoteNotification inputLanguage:(NSString *)inputLanguage WK_AVAILABLE_WATCHOS_ONLY(2.0);

// Subclasses can implement to return an array of suggestions to use as text responses to a local notification.
- (nonnull NSArray<NSString *> *)suggestionsForResponseToActionWithIdentifier:(NSString *)identifier forLocalNotification:(UILocalNotification *)localNotification inputLanguage:(NSString *)inputLanguage WK_AVAILABLE_WATCHOS_ONLY(2.0);

@end

NS_ASSUME_NONNULL_END
//WKInterfaceController.h
//手表套件
//
//版权(c)2014-2015苹果公司。保留所有权利。
//
#进口
#进口
#进口
NS\u假设\u非空\u开始
@集体诉讼;
@类WK接口表;
@WKK类;
@类图像;
@类UILocalNotification;
@类通行证;
typedef NS_枚举(NSInteger、WKUserNotificationInterfaceType){
WKUserNotificationInterfaceTypeDefault,
WKUserNotificationInterfaceTypeCustom,
}NS_ENUM_AVAILABLE_IOS(8_2);
typedef n_ENUM(NSInteger、WKMenuItemIcon){
WKMenuItemIconAccept,//选中标记
WKMenuItemIconAdd,//'+'
WKMenuItemIconBlock,//带斜杠的圆
WKMenuItemIconDecline,//'x'
WKMenuItemIconInfo,//“我”
WKMenuItemIconMaybe,//“?”
WKMenuItemIconMore,/“…”
WKMenuItemIconMute,//带斜杠的扬声器
WKMenuItemIconPause,//暂停按钮
WKMenuItemIconPlay,//播放按钮
WKMenuItemIconRepeat,//循环箭头
WKMenuItemIconResume,//圆形箭头
WKMenuItemIconShare,//共享图标
WKMenuItemIconShuffle,//交换的箭头
WKMenuItemIconSpeaker,//扬声器图标
WKMenuItemIconTrash,//垃圾箱图标
}NS_ENUM_AVAILABLE_IOS(8_2);
typedef NS_枚举(NSInteger、WKTextInputMode){
WKTextInputModePlain,//听写+建议中的文本(无表情符号)
WKTextInputModeAllowEmoji,//来自听写+建议的文本加非动画表情符号
WKTextInputModeAllowAnimatedEmoji,//所有文本,动画表情(GIF数据)
};
typedef NS_枚举(NSInteger、WKAlertControllerStyle){
WKAlertControllerStyleAlert,
WkAlertControllerStyleSideBySide按钮Alert,
WKAlertControllerStyleActionSheet,
}仅提供WK__WATCHOS_(2.0);
typedef n_ENUM(NSInteger、WKVideoGravity){
WKVideoGravityResizeAspect,
WKVideoGravityResizeAspectFill,
WKVideoGravityResize
}仅提供WK__WATCHOS_(2.0);
/*
可以指定以下预设值以指示所需的输出采样率。产生的比特率取决于预设和音频格式。从输出URL扩展名推断音频文件类型。从音频文件类型推断音频格式。支持的文件类型包括.wav、.mp4和.m4a。当URL扩展名为.wav时,音频格式为LPCM。所有其他情况均为AAC。
*/
typedef NS_枚举(Ninteger、WKAudioRecorderPreset){
WkAudioRecorderPreset窄带语音,/@8kHz,LPCM 128kbps,AAC 24kbps
WkAudioRecorder重置宽带语音,/@16kHz,LPCM 256kbps,AAC 32kbps
WkAudioRecorderResetHighqualityAudio/@44.1kHz,LPCM 705.6kbps,AAC 96kbps
}仅提供WK__WATCHOS_(2.0);
工作班可用IOS(8个2个)
@接口WKInterfaceController:NSObject
-(instancetype)初始化指定的初始化器;
-(void)awakeWithContext:(可空id)context;//来自执行推送或模态表示的控制器的上下文。默认不起任何作用
@属性(非原子,只读)CGRect contentFrame;
-(无效)将激活;//当监视界面处于活动状态且能够更新时调用。当接口不可见时可以调用。
-(无效)取消激活;//当监视界面不再处于活动状态且无法更新时调用。
-(无效)未显示工作(仅适用于WATCHOS)(2.0);//当监视界面对用户可见时调用
-(无效)将消失仅可使用的WK_WATCHOS_(2.0);//当监视界面即将不可见时调用
-(无效)PickerdFocus:(WKInterfacePicker*)PickerWk_可用_手表_(2.0);
-(无效)PickerDirdesignFocus:(WKInterfacePicker*)PickerWk_可用_手表_(2.0);
-(无效)pickerDidSettle:(WKInterfacePicker*)PickerWk_可用_手表_(2.0);
-(void)table:(WKInterfaceTable*)table didSelectRowAtIndex:(NSInteger)rowIndex;//如果控制器具有WKInterfaceTable属性,则行选择
-(void)handleActionWithIdentifier:(可为空的NSString*)远程通知标识符:(NSDictionary*)远程通知;//当应用程序从通知启动时。若从通知UI中的应用程序图标启动,则标识符将为空
-(void)handleActionWithIdentifier:(可为null的NSString*)localNotification的标识符:(UILocalNotification*)localNotification;//当应用程序从通知启动时。若从通知UI中的应用程序图标启动,则标识符将为空
-(void)handleUserActivity:(可为空的NSDictionary*)用户信息;//使用用户信息在根控制器上调用
-(void)setTitle:(可为空的NSString*)title;//控制人的头衔。控制器激活时显示
-(void)pushControllerWithName:(NSString*)名称上下文:(可空id)上下文;//通过initWithContext传递给子控制器的上下文:
-(无效)POP控制器;
-(无效)popToRootController;
+(void)重载rootcontrollerswithnames:(NSArray*)名称上下文:(可为空的NSArray*)上下文;
-(无效)成为当前页面;
-(void)presentControllerWithName:(NSString*)名称上下文:(可空id)上下文;//情态表达
-(void)presentControllerWithNames:(NSArray*)名称上下文:(可为空的NSArray*)上下文;//分页控制器的模态表示。与控制器匹配的上下文
-(无效)解除控制人职务;
-(void)presentTextInputControllerWithSuggestions:(可为空的NSArray*)建议allowedInputMode:(WKTextInputMode)inputMode完成:(void(^)(NSArray*u可为空的结果))完成;//如果取消,结果为零
-(void)presentTextInputControllerWithSuggestionsForLanguage:(NSArray*\uuu nullable)