轉帖link
前两天,遇到一个莫名其妙的问题。
使用UINavigationController push一个新的controller的时候, 动画过程中rootController的view上的元素总是会有一部分叠加在新的controller的view上,
造成视觉混乱。
后来发现,由于创建controller 时,view默认的background color为透明色。(主要是当所有的view背景均显示为白色的时候,很难去发现这个背景色是透明的)
只要讲这个背景色改成非透明色即可!
在这里留个记号!
Translate
2014年7月20日 星期日
2014年6月26日 星期四
Facebook Creat App Status for iOS
2014年6月10日 星期二
UIDocumentInteractionController 快速分享到其他應用程式
sample code
#import
@interface ViewController : UIViewController
{
IBOutlet UIImageView *img;
BOOL preview;
UIDocumentInteractionController *documentInteractionController;
}
@end
- (IBAction)shareDocument:(id)sender
{
NSURL *URL = [[NSBundle mainBundle] URLForResource:@"test" withExtension:@"png"];
if (URL)
{
// Initialize Document Interaction Controller
documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL];
if (preview)
{
[documentInteractionController setDelegate:self];
[documentInteractionController presentPreviewAnimated:YES];
}
else
{
[documentInteractionController presentOpenInMenuFromRect:[sender frame] inView:self.view animated:YES];
}
}
}
#pragma mark -
#pragma mark - UIDocumentInteractionControllerDelegate
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
return self;
}
- (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller
{
return self.view;
}
- (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller
{
return self.view.frame;
}
2014年6月5日 星期四
2014年5月14日 星期三
2014年4月11日 星期五
iOS7 取得麥克風權限
Add framework
#import AVFoundation/AVFoundation.h
#import AVFoundation/AVFoundation.h
//取得錄音權限
- (BOOL)canRecord
{
__block BOOL bCanRecord = YES;
if ([[[UIDevice currentDevice] systemVersion] compare:@"7.0"] != NSOrderedAscending)
{
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
if ([audioSession respondsToSelector:@selector(requestRecordPermission:)]) {
[audioSession performSelector:@selector(requestRecordPermission:) withObject:^(BOOL granted) {
if (granted) {
bCanRecord = YES;
} else {
bCanRecord = NO;
}
}];
}
}
return bCanRecord;
}
#pragma mark - Audio Recorder √
/*開始錄音*/
- (void)startToRecord:(id)sender
{
if (![self canRecord]) {
[[[UIAlertView alloc] initWithTitle:nil
message:[NSString stringWithFormat:@"%@需要訪問你的麥克風。\n請起用麥克風-設定/隱私/麥克風", [TIXAAppMonitor sharedMonitor].appName]
delegate:nil
cancelButtonTitle:@"好"
otherButtonTitles:nil] show];
return;
}
}
訂閱:
文章 (Atom)



