-1
我是一位老人,試圖學習新的。這工作正常。與Scrollview拼搏
@implementation MESViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view= [[QuartzLineView alloc] initWithFrame:CGRectZero];}
-(void)Play{
for(int i=0;i<2000;i++){
short int lineno=function result;
CGRect myRect=CGRectMake(0,lineno, 1024,lineno+235);
[self.view setNeedsDisplayInRect:myRect];}
但是,使用scrollview視圖似乎根本沒有重繪。 滾動查看顯示並確定觸摸輸入。
#import <UIKit/UIKit.h
@interface MESViewController : UIViewController<UIScrollViewDelegate>
@property (nonatomic, strong) IBOutlet UIScrollView *scrollView;
@end
@implementation MESViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.scrollView=[[UIScrollView alloc] initWithFrame: CGRectMake(0, 0, x, y)];
self.scrollView.contentSize=CGSizeMake(x,y);
UIView *myview= [[QuartzLineView alloc] initWithFrame: CGRectMake(0, 0, x, y)];
[self.scrollView addSubview:myview];
self.view=self.scrollView;}
-(void)Play{...as above}
@implementation QuartzLineView
- (instancetype)initWithFrame:(CGRect)r{
self = [super initWithFrame:CGRectMake(0, 0, x, y];
if (self) {
self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:1.0];
self.multipleTouchEnabled = YES;
}
return self;}
'#進口
問題不清楚,你能解釋一下你想達到什麼嗎? – Suryakant
第二個代碼段的第一部分包含\t #import
marksmithnottingham