Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>this is my answer, thx all geek</p> <pre><code>obj-c </code></pre> <p>here is code:</p> <pre><code>-(void) listenerData:(NSNotification *) notify { int resnum=112222; unsigned int bitsum=0; for(int i=0;i&lt;4;i++) { bitsum+=(resnum&gt;&gt;(i*8))&amp;0xff; } bitsum=bitsum&amp;0xff; NSString * check=[NSString stringWithFormat:@"%x %x",resnum,bitsum]; check=nil; self.drawData=notify.object;`` [self setNeedsDisplay]; } -(void)drawRect:(CGRect)rect { NSArray *data=self.drawData; NSData *tdata=[data objectAtIndex:0]; double *srcdata=(double*)tdata.bytes; int datacount=tdata.length/sizeof(double); tdata=[data objectAtIndex:1]; double *coveddata=(double*)tdata.bytes; CGContextRef context=UIGraphicsGetCurrentContext(); CGRect bounds=self.bounds; CGContextClearRect(context, bounds); CGFloat midpos=bounds.size.height/2; CGContextBeginPath(context); const double scale=1.0/100; CGFloat step=bounds.size.width/(datacount-1); CGContextMoveToPoint(context, 0, midpos); CGFloat xpos=0; for(int i=0;i&lt;datacount;i++) { CGContextAddLineToPoint(context, xpos, midpos-srcdata[i]*scale); xpos+=step; } CGContextAddLineToPoint(context, bounds.size.width, midpos); CGContextClosePath(context); CGContextSetRGBFillColor(context, 1.0, 0.0, 0.0, 1.0); CGContextFillPath(context); CGContextBeginPath(context); const double scale2=1.0/100; CGContextMoveToPoint(context, 0, midpos); xpos=0; for(int i=0;i&lt;datacount;i++) { CGContextAddLineToPoint(context, xpos, midpos+coveddata[i]*scale2); xpos+=step; } CGContextAddLineToPoint(context, bounds.size.width, midpos); CGContextClosePath(context); CGContextSetRGBFillColor(context, 1.0, 0.0, 1.0, 1.0); CGContextFillPath(context); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload