This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[self.gUserNameTextField setValue:[UIColor redColor] | |
forKeyPath:@"_placeholderLabel.textColor"]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
} |