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
TextField( | |
keyboardType: TextInputType.number, | |
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r'[0-9]'))], | |
decoration: InputDecoration( | |
hintText: "入れ替えの比例", | |
hintStyle: TextStyle(fontSize: 14, color: AppColors.color_cccccc), | |
fillColor: AppColors.color_f6f6f6, | |
filled: true, | |
border: | |
OutlineInputBorder(borderRadius: BorderRadius.circular(6), borderSide: BorderSide.none), |
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
// 一般赋值使用的是_controller.text = "demo"; | |
// 如果要使光标置于最后要使用下面这种方式 | |
_controller.value = TextEditingValue( | |
text: result, | |
selection: TextSelection.fromPosition(TextPosition( | |
affinity: TextAffinity.downstream, | |
offset: result.length | |
)) | |
); |
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
<key>NSAppTransportSecurity</key> | |
<dict> | |
<key>NSExceptionDomains</key> | |
<dict> | |
<key>www.baidu.com</key> | |
<dict> | |
<key>NSIncludesSubdomains</key> | |
<true/> | |
<key>NSExceptionRequiresForwardSecrecy</key> | |
<false/> |
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
private var isConnectedToVpn: Bool { | |
if let settings = CFNetworkCopySystemProxySettings()?.takeRetainedValue() as? Dictionary<String, Any>, | |
let scopes = settings["__SCOPED__"] as? [String:Any] { | |
for (key, _) in scopes { | |
if key.contains("tap") || key.contains("tun") || key.contains("ppp") || key.contains("ipsec") || key.contains("ipsec0") { | |
return true | |
} | |
} | |
} | |
return false |
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
class Test { | |
dynamic func foo() { | |
print("bar") | |
} | |
} | |
extension Test { | |
@_dynamicReplacement(for: foo()) | |
func foo_new() { | |
print("bar new") |
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
let shadowPath = UIBezierPath.init(rect: regiseButton.bounds) | |
regiseButton.layer.masksToBounds = false; | |
regiseButton.layer.shadowColor = UIColor.black.cgColor | |
regiseButton.layer.shadowOffset = CGSize(width: 0, height: 0) | |
regiseButton.layer.shadowOpacity = 1; | |
regiseButton.layer.shadowRadius = 25 | |
regiseButton.layer.shadowPath = shadowPath.cgPath; |
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
//要先添加到view上,不然不显示, | |
TextView.addSubview(label) | |
TextView.setValue(label, forKey: "_placeholderLabel") |
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
// 如果是系统的弹窗,则无法获取到,比如在用Airprint,这时是无法获取到的,结果为nil | |
func getPrexxx() -> UIViewController { | |
var result = UIApplication.shared.keyWindow?.rootViewController | |
while ((result?.presentedViewController) != nil) { | |
result = result?.presentedViewController | |
} | |
return result | |
} |
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
// 截取屏幕生成UIImage | |
func shoutScreen() -> UIImage { | |
let render = UIGraphicsImageRenderer(size: (window?.bounds.size)!) | |
let image = render.image { (ctx) in | |
window?.drawHierarchy(in: window!.bounds, afterScreenUpdates: false) | |
} | |
return img | |
} |
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
if [ $CONFIGURATION == Debug ]; then | |
echo "当前为 Release Configuration,开始自增 Build" | |
plist=${INFOPLIST_FILE} | |
buildnum=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${plist}") | |
if [[ "${buildnum}" == "" ]]; then | |
echo "Error:在Plist文件里没有 Build 值" | |
exit 2 | |
fi | |
buildnum=$(expr $buildnum + 1) | |
/usr/libexec/PlistBuddy -c "Set CFBundleVersion $buildnum" "${plist}" |
NewerOlder