Skip to content

Instantly share code, notes, and snippets.

// orogin swift protocol and calling
protocol aProtocol {
func testFunc()
}
class aStruct: aProtocol {
func testFunc() {} // override defualt implementation
}
class bStruct: aProtocol {
func testFunc() {} // override defualt implementation
}
@gpake
gpake / gist:59b5d528f97c69d545c4a8b48e5fb308
Created September 9, 2018 16:13
InjectionIII double calling 2nd
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 2.9
* frame #0: 0x0000000124f06a23 eval112.dylib`DetailViewController.injected(self=<unavailable>) at DetailViewController.swift:17
frame #1: 0x0000000124f06af4 eval112.dylib`@objc DetailViewController.injected() at DetailViewController.swift:0
frame #2: 0x0000000122b20a34 iOSInjection`partial apply ObjC forwarder with unmangled suffix ".88" + 20
frame #3: 0x0000000122b1a017 iOSInjection`closure #4 (Swift.AnyObject) -> () in static iOSInjection.SwiftInjection.inject(tmpfile: Swift.String) throws -> () + 727
frame #4: 0x0000000122b1a1d1 iOSInjection`partial apply forwarder for closure #4 (Swift.AnyObject) -> () in static iOSInjection.SwiftInjection.inject(tmpfile: Swift.String) throws -> () + 17
frame #5: 0x0000000122b1c731 iOSInjection`iOSInjection.SwiftSweeper.sweepInstance(Swift.AnyObject) -> () + 833
frame #6: 0x0000000122b1bdc2 iOSInjection`iOSInjection.SwiftSweeper.sweepValue(Any) -> () + 2546
f
@gpake
gpake / gist:ebf64df9f3595033391ec45830cad4b3
Created September 9, 2018 16:12
InjectionIII double calling 1st
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 2.9
* frame #0: 0x0000000124f06a23 eval112.dylib`DetailViewController.injected(self=<unavailable>) at DetailViewController.swift:17
frame #1: 0x0000000124f06af4 eval112.dylib`@objc DetailViewController.injected() at DetailViewController.swift:0
frame #2: 0x0000000122b20a34 iOSInjection`partial apply ObjC forwarder with unmangled suffix ".88" + 20
frame #3: 0x0000000122b1a017 iOSInjection`closure #4 (Swift.AnyObject) -> () in static iOSInjection.SwiftInjection.inject(tmpfile: Swift.String) throws -> () + 727
frame #4: 0x0000000122b1a1d1 iOSInjection`partial apply forwarder for closure #4 (Swift.AnyObject) -> () in static iOSInjection.SwiftInjection.inject(tmpfile: Swift.String) throws -> () + 17
frame #5: 0x0000000122b1c731 iOSInjection`iOSInjection.SwiftSweeper.sweepInstance(Swift.AnyObject) -> () + 833
frame #6: 0x0000000122b1e030 iOSInjection`closure #1 (Swift.UnsafePointer<Swift.Optional<Swift.AnyObje
http://stackoverflow.com/questions/15704163/draw-shadow-only-from-3-sides-of-uiview
I know you say setting layer.shadowOffset won't work for you, but you are allowed to put in negative values so setting it layer.shadowOffset = CGSizeMake(0.0, -2.0) would come close to the effect you're looking for but of course I expect you want it to be even on the three sides.
So here we go with layer.shadowPath!
UIView *block1 = [[UIView alloc] initWithFrame:CGRectMake(32.0, 32.0, 128.0, 128.0)];
[block1 setBackgroundColor:[UIColor orangeColor]];
[self.view addSubview:block1];
@gpake
gpake / gist:6266538
Last active December 21, 2015 06:48
In your current code, you save the GState of the current context, configure it to draw a shadow .. and the restore it to what it was before you configured it to draw a shadow. Then, finally, you invoke the superclass's implementation of drawRect:
In your current code, you save the GState of the current context, configure it to draw a shadow .. and the restore it to what it was before you configured it to draw a shadow. Then, finally, you invoke the superclass's implementation of drawRect: .
Any drawing that should be affected by the shadow setting needs to happen after
CGContextSetShadow(currentContext, CGSizeMake(-15, 20), 5);
but before
CGContextRestoreGState(currentContext);
So if you want the superclass's drawRect: to be 'wrapped' in a shadow, then how about if you rearrange your code like this?
@gpake
gpake / gist:3617893
Created September 4, 2012 07:09
change the textfield's placeholder
[self.gUserNameTextField setValue:[UIColor redColor]
forKeyPath:@"_placeholderLabel.textColor"];
//get ip form local
string name = dns.getHostName();//the host's name
IPHostEntry me = dns.getHostEntry(name);
foreach(IPAddress ip in me.AddressList) {
listbox.items.add(ip)
}
IPAddress localip = IPaddress.pares(@"127.0.0.1");
IPEndPoint iep = new IPEndPoint(localip, 80);
@gpake
gpake / gist:1853450
Created February 17, 2012 13:29
I want my window's background to be yellow
//Why you'd want to do that, I don't know,
//but someone asked me how to turn the window background yellow.
//Since the window has a contentView NSView in it,
//this adds a category on it that draws the background with a transparent yellow.
//You also get the pinstripe effects. Just put this code anywhere.
@implementation NSView (BWYellowView)
- (void) drawRect: (NSRect) rect
{
NSColor *transparentYellow;