大佬教程收集整理的这篇文章主要介绍了objective-c – PDFView setNeedsDisplay:YES在MacOS Sierra 10.12上不起作用,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
NSRect newBounds; NSRect currentBounds; NSRect dirtyRect; NSPoint mouseLoc; NSPoint endPt; // Where is Annotation Now? currentBounds = [_activeAnnotation bounds]; // Mouse in display view coordinates. mouseLoc = [self convertPoint: [theEvent LOCATIOnInWindow] fromView: NULL]; // Convert end point to page space. if(activePage == nil) activePage =[_activeAnnotation page]; _LinePoint= [self convertPoint: mouseLoc toPage: activePage]; endPt = [self convertPoint: mouseLoc toPage: activePage]; if(_SELEctedIdx == 3) //ink { [(PDFAnnotationInk*)_activeAnnotation removeBezierPath:_path]; //endPt.x=_xPoint.x; //竖线 //endPt.y=_xPoint.y; //横线 [_path lineToPoint:endPt]; // 普通笔 [(PDFAnnotationInk*)_activeAnnotation addBezierPath:_path]; [self AnnotationChanged]; [self setNeedsDisplay:YES]; return;@H_673_20@更新: @H_673_20@我发现setNeedsDispaly调用drawPage:toContext:但是绘图代码在drawPage:toContext中不起作用: @H_673_20@
- (void)drawPage:(PDFPage *)pdfPage toContext(CGContextRef)context { [super drawPage: pdfPage toContext:context]; NSBezierPath *line=[NSBezierPath bezierPath]; [line moveToPoint:_xPoint]; [line lineToPoint:NsmakePoint(150,150)]; [[NSColor redColor] set]; [line setLineWidth:50] ; [line stroke]; }@H_673_20@调试说CGContextSetFillColorWithColor:无效的上下文0x0和更多无效的上下文0x0警告.
previewView.layoutDocumentView() for pageIndex in 0...pdf.PageCount - 1 { let page = pdf.page(at: pageIndeX)! previewView.AnnotationsChanged(on: pagE) }@H_673_20@从NSView我尝试过: @H_673_20@
previewView.needsDisplay = true previewView.needsLayout = true previewView.documentView?.needsDisplay = true previewView.updateLayer()@H_673_20@但没有运气.我已尝试用代码滚动PDFView,但它不是一种可靠的方式来偷偷摸摸,并且通常不应该是这样做的方法.
以上是大佬教程为你收集整理的objective-c – PDFView setNeedsDisplay:YES在MacOS Sierra 10.12上不起作用全部内容,希望文章能够帮你解决objective-c – PDFView setNeedsDisplay:YES在MacOS Sierra 10.12上不起作用所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。