A:There’s a difference between self.methodname (which you are using), and Classname.methodname.
The former, when called within a class’s method, will give you a function bound with that class instance. So if you call it, it will be called on that instance.
The latter gives you a curried function that takes as an argument any instance of Classname, and returns a new function that is bound to that instance. At this point, that function is like the first case (only you can bind it to any instance you like).
Here’s an example to try and show that a bit better:
12345678910111213141516171819202122232425262728
class C {
private let _msg: String
init(msg: String) { _msg = msg }
func c_print() { print(_msg) }
func getPrinter() -> ()->() { return self.c_print }
}
let c = C(msg: "woo-hoo")
let f = c.getPrinter()
// f is of type (())->()
f() // prints "woo-hoo"
let d = C(msg: "way-hey")
let g = C.c_print
// g is of type (C) -> (()) -> (),
// you need to feed it a C:
g(c)() // prints "woo-hoo"
g(d)() // prints "way-hey"
// instead of calling immediately,
// you could store the return of g:
let h = g(c)
// at this point, f and h amount to the same thing:
// h is of type (())->()
h() // prints "woo-hoo"
6.Required plug-in compatibility UUID 37B30044-3B14-46BA-ABAA-F01000C27B63 for plug-in at path ‘~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Unity4XC.xcplugin’ not present in DVTPlugInCompatibilityUUIDs
A:There isn’t official document about developing plugin for Xcode, so we can only attempt to solve it. Thanks to the internet, we can get a solution by other figure out.
12
XCODEUUID=`defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID`
for f in ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins/*; do defaults write "$f/Contents/Info" DVTPlugInCompatibilityUUIDs -array-add $XCODEUUID; done
The reason probably is plugin developed compate with old Xcode, so it of course don’t contain the lastest Xcode’s UUID, we can manual add it if it really compate with the latest Xcode.
8.Operation stopped, the video could not be composed.
1
Domain=AVFoundationErrorDomain Code=-11841 "Operation Stopped" UserInfo=0x1912c320 {NSLocalizedDescription=Operation Stopped, NSLocalizedFailureReason=The video could not be composed.}
A: We should instance AVMutableComposition, AVMutableCompositionTrack every time when edit.
12. Is there a “space” character that is NOT trimmed from end of UILabel?
A:I haven’t found such character yet. Follow sulotion is a workaround:
1234567891011121314
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:text attributes:@{NSForegroundColorAttributeName : [UIColor blackColor]}];
[string insertAttributedString:[self emptyAtributedWhitespace] atIndex:0];
[string appendAttributedString:[self emptyAtributedWhitespace]];
label.attributedText = string;
...
- (NSAttributedString *)emptyAtributedWhitespace
{
// You can put any random string there or how many spaces you want
return [[NSAttributedString alloc] initWithString:@"_" attributes:@{ NSForegroundColorAttributeName : [UIColor clearColor]}];
}