在Objective-C中,我们可以通过采用UIDynamicItem协议来定制对象,如下所示:
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface LCDynamicItem : NSObject <UIDynamicItem>
@property (nonatomic, readwrite) CGPoint center;
@property (nonatomic, readonly) CGRect bounds;
@property (nonatomic, readwrite) CGAffineTransform transform;
@end
但我怎样才能在swift中使用它。
我不知道,有人帮忙吗?
答案 0 :(得分:0)
在swift中你的代码将是
class LCDynamicItem: NSObject, UIDynamicItem {
var center: CGPoint
var bounds: CGRect {
get {
return self.bounds
}
}
var transform: CGAffineTransform
}