![](/img/trans.png)
[英]Provisioning Profile for Apple Watch App & Watch Extension
[英]apple watch app conflict uiview extension
我試圖將AppleWatch App添加到自己的應用程序中。但是我收到一條錯誤消息: 找不到'UIView'的接口聲明 ,指向我在其中定義UIView擴展名的文件,如下圖所示(I' ve在pch文件中添加import UIKit / UIKit.h>代碼:
UIView+KKFrameExtension.h
@interface UIView (KKFrameExtension)
@property (nonatomic,assign) CGFloat width;
@property (nonatomic,assign) CGFloat height;
@property (nonatomic,assign) CGFloat x;
@end
UIView+KKFrameExtension.m
-(CGFloat)width{
return self.frame.size.width;
}
-(void)setWidth:(CGFloat)width{
CGRect frame = self.frame;
frame.size.width = width;
self.frame = frame;
}
// height
-(CGFloat)height{
return self.frame.size.height;
}
-(void)setHeight:(CGFloat)height{
CGRect frame = self.frame;
frame.size.height = height;
self.frame = frame;
}
但是如果我刪除WatchApp,一切正常,那么發生了什么,我該怎么辦?
WatchKit不使用UIViews。 它也不使用UIViewControllers。 它使用WKInterfaceControllers。 通常,UI是在手表應用程序的故事板上創建的,因此您必須在其中創建所需的內容。 創建手表目標時,您應該已經獲得了手表應用和手表擴展的目標。 情節提要將在watch應用程序中(實際上,這就是它的全部內容),而操縱它的代碼將在watch擴展程序中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.