Reputation: 1
I've tried to add a AppleWatch App to my own app.But I got a error says: Cannot find interface declaration for 'UIView',pointed to a file in which i define an extension for UIView,Which looks like below(I've add import UIKit/UIKit.h> code in pch file:
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;
}
but if I delete my WatchApp,everything goes well,so what happened,what should I do?Thanks
Upvotes: 0
Views: 219
Reputation: 5935
WatchKit does not use UIViews. Nor does it use UIViewControllers. It uses WKInterfaceControllers. Generally, UI is created in the watch app storyboard, so you'll have to create what you want there. When you created your watch targets, you should have gotten targets for a watch app and a watch extension. The storyboard will be in the watch app (in fact, that's about all it has), and the code to manipulate it will be in the watch extension.
Upvotes: 0