self.view.alpha = 0.0;
[UIView animateWithDuration: 0.5
animations: ^{
self.view.alpha = 1.0;
}
completion: ^(BOOL finished) {
}
];
2018年1月17日 星期三
2018年1月12日 星期五
在moveRowAtIndexPath動畫之後加入callback
[CATransaction begin];
[CATransaction setCompletionBlock: ^{
// Code to be executed upon completion
[self connectPrinterWithDeviceInfo:deviceInfo];
}];
[tableView beginUpdates];
[tableView moveRowAtIndexPath:indexPath toIndexPath:newIndexPath];
[tableView endUpdates];
[CATransaction commit];
[CATransaction setCompletionBlock: ^{
// Code to be executed upon completion
[self connectPrinterWithDeviceInfo:deviceInfo];
}];
[tableView beginUpdates];
[tableView moveRowAtIndexPath:indexPath toIndexPath:newIndexPath];
[tableView endUpdates];
[CATransaction commit];
2018年1月9日 星期二
在段落中某些特定文字加入連結
- 只有UITextView可以做到。
- 要實作UITextViewDelegate
#pragma mark - UITextViewDelegate
- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(nonnull NSURL *)URL inRange:(NSRange)characterRange {
//可以做些判斷
return YES;
}
- 加入某段文字
NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:str];
[attrStr addAttribute:NSLinkAttributeName value:[NSURL URLWithString:@"https://yourUrl.com"] range:[str rangeOfString:@"Knowledge base"]];
self.linkTextView.attributedText = attrStr;
- 整段文字
NSAttributedString *attrStr = [[NSAttributedString alloc]initWithString:@"please visit our Knowledge base" attributes:dictAttr];
self.linkTextView.attributedText = attrStr;
2018年1月3日 星期三
去特定的setting頁
// wifi settings
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"
App-Prefs
:root=WIFI"]];
// Bluetooth settings
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"
App-Prefs
:root=
Bluetooth
"]];
訂閱:
文章 (Atom)