// return image as PNG. May return nil if image has no CGImageRef or invalid bitmap format UIKIT_EXTERNNSData * __nullableUIImagePNGRepresentation(UIImage * __nonnull image);
// return image as JPEG. May return nil if image has no CGImageRef or invalid bitmap format. compression is 0(most)..1(least) UIKIT_EXTERNNSData * __nullableUIImageJPEGRepresentation(UIImage * __nonnull image, CGFloat compressionQuality);
/* Create a bitmap context. The context draws into a bitmap which is `width' pixels wide and `height' pixels high. The number of components for each pixel is specified by `space', which may also specify a destination color profile. The number of bits for each component of a pixel is specified by `bitsPerComponent'. The number of bytes per pixel is equal to `(bitsPerComponent * number of components + 7)/8'. Each row of the bitmap consists of `bytesPerRow' bytes, which must be at least `width * bytes per pixel' bytes; in addition, `bytesPerRow' must be an integer multiple of the number of bytes per pixel. `data', if non-NULL, points to a block of memory at least `bytesPerRow * height' bytes. If `data' is NULL, the data for context is allocated automatically and freed when the context is deallocated. `bitmapInfo' specifies whether the bitmap should contain an alpha channel and how it's to be generated, along with whether the components are floating-point or integer. */ CG_EXTERNCGContextRef __nullableCGBitmapContextCreate(void * __nullable data, size_t width, size_t height, size_t bitsPerComponent, size_t bytesPerRow, CGColorSpaceRef cg_nullable space, uint32_t bitmapInfo) CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
/** Asynchronous rendering proceeds as follows: * When the view is initially added to the hierarchy, it has -needsDisplay true. * After layout, Core Animation will call -display on the _ASDisplayLayer * -display enqueues a rendering operation on the displayQueue * When the render block executes, it calls the delegate display method (-drawRect:… or -display) * The delegate provides contents via this method and an operation is added to the asyncdisplaykit_async_transaction * Once all rendering is complete for the current asyncdisplaykit_async_transaction, * the completion for the block sets the contents on all of the layers in the same frame */
ASDisplayNode还有一个属性shouldRasterizeDescendants。
/** * @abstract Whether to draw all descendant nodes’ layers/views into this node’s > layer/view’s backing store. * @discussion * When set to YES, causes all descendant nodes’ layers/views to be drawn > directly into this node’s layer/view’s backing * store. Defaults to NO. * If a node’s descendants are static (never animated or never change attributes > after creation) then that node is a * good candidate for rasterization. Rasterizing descendants has two main > benefits: * 1) Backing stores for descendant layers are not created. Instead the layers > are drawn directly into the rasterized * container. This can save a great deal of memory. * 2) Since the entire subtree is drawn into one backing store, compositing and > blending are eliminated in that subtree * which can help improve animation/scrolling/etc performance. * Rasterization does not currently support descendants with transform, > sublayerTransform, or alpha. Those properties * will be ignored when rasterizing descendants. * Note: this has nothing to do with -[CALayer shouldRasterize], which doesn’t > work with ASDisplayNode’s asynchronous * rendering model. */
(lldb) p @[ @"foo", @"bar" ] (NSArray *) $8 = 0x00007fdb9b71b3e0@"2 objects" (lldb) e -O -- $8 <__NSArrayI 0x7fdb9b71b3e0>( foo, bar )
参数 e -O --,缩写是:**po**
(lldb) po $8 <__NSArrayI 0x7fdb9b71b3e0>( foo, bar ) (lldb) po @"lunar" lunar (lldb) p @"lunar" (NSString *) $13 = 0x00007fdb9d0003b0@"lunar"
定义变量
(lldb) e int $a = 2 (lldb) p $a * 19 38 (lldb) e NSArray *$array = @[ @"Saturday", @"Sunday", @"Monday" ] (lldb) p [$array count] 2 (lldb) po [[$array objectAtIndex:0] uppercaseString] SATURDAY (lldb) p [[$array objectAtIndex:$a] characterAtIndex:0] error: no known method '-characterAtIndex:'; cast the message send to the method's return type error: 1 errors parsing expression
(lldb) p i (int) $0 = 99 (lldb) s (lldb) thread returnNO (lldb) n (lldb) p even0 (BOOL) $2 = NO (lldb) frame info frame #0: 0x00000001009a5cc4 DebuggerDance`main + 52 at main.m:17
(lldb) breakpoint set -F isEven Breakpoint 1: where = DebuggerDance`isEven + 16 at main.m:4, address = 0x00000001083b5d00 (lldb) breakpoint modify -c 'i == 99'1 (lldb) breakpoint command add 1 Enter your debugger command(s). Type 'DONE' to end. > p i > DONE (lldb) br li 1 1: name = 'isEven', locations = 1, resolved = 1, hit count = 0 Breakpoint commands: p i
Condition: i == 99
1.1: where = DebuggerDance`isEven + 16 at main.m:4, address = 0x00000001083b5d00, resolved, hit count = 0
(lldb) e (void)[$myView setBackgroundColor:[UIColor blueColor]]
更新到渲染服务中:
(lldb) e (void)[CATransaction flush] // caflush
Push 一个 View Controller
获取rootVC:
(lldb) e id $nvc = [[[UIApplication sharedApplication] keyWindow] rootViewController]
然后 push 一个 child view controller:
(lldb) e id $vc = [UIViewController new] (lldb) e (void)[[$vc view] setBackgroundColor:[UIColor yellowColor]] (lldb) e (void)[$vc setTitle:@"Yay!"] (lldb) e (void)[$nvc pushViewContoller:$vc animated:YES]
最后最新下面命令:
(lldb) caflush // e (void)[CATransaction flush]
查看按钮的 target
(lldb) po [$myButton allTargets] {( <MagicEventListener: 0x7fb58bd2e240> )} (lldb) po [$myButton actionsForTarget:(id)0x7fb58bd2e240 forControlEvent:0] <__NSArrayM 0x7fb58bd2aa40>( _handleTap: )
向右一个字符(forward) control + F 向左一个字符(backward) control + B 向前一行(previous) control + P 向后一行(next) control + N 去行首 control + A 去行尾(end) control + E 调换光标两边的字符(transpose) control + T 删除右侧的字符(delete) control + D 删除本行剩余的字符(kill) control + K