我正在尝试做日历的日视图。在android上我创建了一个画布(比屏幕大)并将其放在一个scrollview上。一切都很棒。抽签结束后,我可以滚动画布。
但是在iOS上,当我在UIScrollView上绘图时,我无法在屏幕上进行任何滚动手势。任何人都可以帮助我吗?
for (int i = 1; i <18; i++){
UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(40, i*80, 240, 1)];
lineView.backgroundColor = [UIColor blackColor];
[self.scrollView addSubview:lineView];
int n = i+7;
NSString *str = nil;
if(n<10){
str = [NSString stringWithFormat:@"0%d:00", n];
}
else{str = [NSString stringWithFormat:@"%d:00", n];}
UIFont *font = [UIFont systemFontOfSize:13.0f];
NSMutableAttributedString *s2 = [[NSMutableAttributedString alloc] initWithData:[str dataUsingEncoding:NSUTF8StringEncoding] options:@{NSDocumentTypeDocumentAttribute:NSPlainTextDocumentType} documentAttributes:nil error:nil];
[s2 addAttributes:@{NSFontAttributeName: font} range:NSMakeRange(0, s2.length)];
UILabel *hour = [[UILabel alloc] initWithFrame:CGRectMake(0, i*80-4, 240, 10)];
hour.attributedText = s2;
[self.scrollView addSubview:hour];