iOS小记
来源:互联网 发布:免费摇号软件 编辑:程序博客网 时间:2024/05/16 05:09
1.iOS切换使用http :
- UIImage *pic = [ UIImage imageNamed:@"IMG_0404.PNG"];
- UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(20, 20, 240, 100 )];
- [imageView setImage:pic];
- [imageView setContentScaleFactor:[[UIScreen mainScreen] scale]]; //根据屏幕类别选择图片
- imageView.contentMode = UIViewContentModeScaleAspectFill;
- imageView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
- imageView.clipsToBounds = YES;
http://www.cnblogs.com/newstar/archive/2011/01/04/svn.html
4,Search Bar 怎样去掉背景的颜色(storyboard里只能设置background颜色,可是发现clear Color无法使用)
其实在代码里还是可以设置的,那就是删除背景view
[[self.searchBar.subviews objectAtIndex:0] removeFromSuperview];
5.iOS8后本地通知设置http://blog.csdn.net/woaifen3344/article/details/44302635
6.录音设置
```
recordSetting = [[NSMutableDictionary alloc]init];
//设置录音格式 AVFormatIDKey==kAudioFormatLinearPCM
[recordSetting setValue:[NSNumber numberWithInt:kAudioFormatMPEG4AAC] forKey:AVFormatIDKey];
//设置录音采样率(Hz) 如:AVSampleRateKey==8000/44100/96000(影响音频的质量)
[recordSetting setValue:[NSNumber numberWithFloat:44100] forKey:AVSampleRateKey];
//录音通道数 1 或 2
[recordSetting setValue:[NSNumber numberWithInt:1] forKey:AVNumberOfChannelsKey];
//线性采样位数 8、16、24、32
[recordSetting setValue:[NSNumber numberWithInt:16] forKey:AVLinearPCMBitDepthKey];
//录音的质量
[recordSetting setValue:[NSNumber numberWithInt:AVAudioQualityHigh] forKey:AVEncoderAudioQualityKey];
// recordSetting = [[NSDictionary alloc] initWithObjectsAndKeys:
//
// [NSNumber numberWithFloat: 44100.0],AVSampleRateKey, //采样率
//
// [NSNumber numberWithInt: kAudioFormatLinearPCM],AVFormatIDKey,
//
// [NSNumber numberWithInt:16],AVLinearPCMBitDepthKey,//采认16
//
// [NSNumber numberWithInt: 2], AVNumberOfChannelsKey,//通道的数目
//
// [NSNumber numberWithBool:NO],AVLinearPCMIsBigEndianKey,//大端还是小端是内存的组织方式
//
// [NSNumber numberWithBool:NO],AVLinearPCMIsFloatKey,nil];
// NSString *strUrl = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
//recordedFile=[NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/lll.aac", strUrl]];
recordedFile = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent: [NSString stringWithFormat: @"%.0f.%@", [NSDatetimeIntervalSinceReferenceDate] * 1000.0, @"aac"]]]; //文件名的设置
// tmpFile = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingString:@"RecordedFile"]];
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayAndRecorderror: nil];
NSError *error = nil;
recorder = [[AVAudioRecorder alloc] initWithURL:recordedFilesettings:recordSetting error:&error];
if (recorder!= nil) {
recorder.delegate = self;
if ([recorder prepareToRecord] == YES&&[recorder record]==YES)
{
NSLog(@"录制声音开始!");
} else {
NSLog(@"录制失败!%@",error);
int errorCode = CFSwapInt32HostToBig ([error code]);
NSLog(@"Error: %@ [%4.4s])" , [error localizedDescription], (char*)&errorCode);
}
} else {
NSLog(@"auioRecorder实例创建失败!");
}
```
- iOS小记
- iOS 小记
- ios小记
- ios开发小记
- IOS学习:UIView小记
- iOS: NSTimer使用小记
- iOS 小记(1)
- iOS: NSTimer使用小记
- ios经验小记
- 【iOS】文件上传小记
- 【iOS】文件下载小记
- ios警告小记
- ios打包小记
- ios开发小记
- ios Mantle使用小记
- Ios小记整理
- ios Mantle使用小记
- IOS细节小记
- Keil C51详细设置
- MyEclipse 6.5安装maven插件
- 《编程之美》——计算字符串的相似度
- Spring集成ActiveMQ
- JavaScript基础学习(五)---Math(算数)对象
- iOS小记
- Android 向SD卡写入文件_1
- lightoj 1114(trie)
- 锁的效率很低
- rpc.rstatd安装与配置
- PEP8 Python 编码规范整理
- C#学习笔记 LINQ简单使用
- Codevs_P2123 麦森数2
- protobuff的repeat参数是类似数组的存在