我正在实施录音.它与caf
&wave
格式工作正常.但问题是文件太大.
那么,任何人都可以帮助我录制音频,其格式也会在窗口和文件大小上播放.
我试过的代码如下:
dirPaths = NSSearchPathForDirectoriesInDomains(
NSDocumentDirectory, NSUserDomainMask, YES);
docsDir = [dirPaths objectAtIndex:0];
NSString *soundFilePath = [docsDir
stringByAppendingPathComponent:@"sound.wave"];
NSLog(@"%@",soundFilePath);
NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];
NSDictionary *recordSettings = [NSDictionary
dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:AVAudioQualityMin],
AVEncoderAudioQualityKey,
[NSNumber numberWithInt:16],
AVEncoderBitRateKey,
[NSNumber numberWithInt: 2],
AVNumberOfChannelsKey,
[NSNumber numberWithFloat:8000.0], AVSampleRateKey,
[NSNumber numberWithInt:8], AVLinearPCMBitDepthKey,
nil];
NSError *error = nil;
audioRecorder = [[AVAudioRecorder alloc]
initWithURL:soundFileURL
settings:recordSettings
error:&error];
if (error)
{
NSLog(@"error: %@", [error localizedDescription]);
} else {
[audioRecorder prepareToRecord];
}
Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我有一个字符串,如:
"3022513240"
我想将其转换为:
(302)-251-3240
我怎么解决这个问题?
在我的应用程序中,我想在iPad中显示多列tableView.
所以,我使用了来自MultiColumn TableView的cocoa控件
它适用于我,但我想以交替颜色显示行.
为此,我无法找到我为其更改代码的位置.
帮我解决这个问题.
我有一个图像,我想通过编程方式更改该图像的颜色.
&我想改变这一形象的颜色
我必须为我的应用实现文件上传.资产(可以是照片或视频)等文件应使用REST界面上传到Web服务器.
上传将使用具有自定义标头属性的表单数据请求.
问题:
在NSData
对象中保存像视频一样的大文件可能会导致内存问题.这将是标准方法.
解决方案
为NSInputStream
请求的正文部分提供 - 并将数据逐段写入HTTP Body Stream.
问题任何人都可以提供一个如何使用NSInputStream结合a NSURLrequest
和NSURLConnection
?的例子.
我围绕着几个不完整的例子 -
但我不知道如何处理以下方法
- (NSInputStream *)connection:(NSURLConnection *)connection needNewBodyStream:(NSURLRequest *)request
Run Code Online (Sandbox Code Playgroud)
我不想使用任何第三方库.
我想将ios 5和ios 6整合在一起.
我知道将facebook整合到个人ios(即ios 5或ios 6)中,但不知道如何支持ios 5和ios 6的facebook.
换句话说,如何为ios 5和ios 6整合facebook?或者在两个ios中支持这个的常用方法是什么?
谢谢
我有奇怪的问题.我开发了使用分发配置文件签名的应用程序代码,其中包含正确的设备并将其发送给客户端.他通过iTunes安装,没有任何问题.突然,iTunes 11发布了,客户告诉我他无法在他的设备上安装应用程序.
情况如下:
同步转到步骤4,其中消息说准备同步的应用程序并且同步结束在iTunes中显示应用程序安装在设备上.但在设备上没有应用程序.没有错误或任何消息,没有...
为了使事情变得更复杂,我可以在我的设备上安装应用程序(我甚至从朋友那里借了iPad,iPhone和一个iPod touch来检查它).虽然我无法在一台iPod Touch 4G上安装它.该应用程序与iOS 5和6兼容.
有任何想法吗?
我已经实现了feed解析并将内容作为字符串获取.现在,我正在通过它进行html文件编程.在Web视图中加载该HTML.我的Web视图是表视图单元格中的子视图.
但是现在我想要更改Web视图内容的字体大小,以便用户可以看到一些细节.
我的HTML生成代码是:
Run Code Online (Sandbox Code Playgroud)NSString * postHTML=[[_parseResults objectAtIndex:indexPath.row]valueForKey:@"summary"]; NSString *close =[NSString stringWithFormat:@"</body></html>"]; NSString *HTMLString = [NSString stringWithFormat:@"%@%@", postHTML,close]; [Web_view loadHTMLString:HTMLString baseURL:nil]; [cell.contentView addSubview:Web_view]; return cell;
如何更改Web视图内容的字体大小?
我尝试以编程方式创建HTML文件.但生成的文件显示为空白文件.我不知道这个问题.
这是我的代码:
- (IBAction) createFileAction
{
NSLog(@"************* createFileAction *************");
NSMutableString *htmlString = [[NSMutableString alloc] init];
NSLog(@"%@",htmlString);
[htmlString appendString:@"<html><head><title></title><style type='text/css'>.style1{height: 27px;}#Text1{height: 19px;width: 210px;}.style2{width: 255px;}.style3{height: 27px;width: 255px;}#petValue{width: 206px;}#nameValue{width: 206px;}#dateValue{width: 209px;}"];
[htmlString appendString:@"#Text2{width: 215px;}#Text3{width: 210px;height: 22px;}#Text4{width: 209px;}.style8{width: 13px;}.style9{ width: 263px;}.style10{height: 27px;width: 263px;}"];
[htmlString appendString:@".style11{width: 418px;}.style12{width: 199px;}.style13{height: 27px; width: 199px;}.style14{height: 24px;}.style15{width: 410px;}</style> </head>"];
[htmlString appendString:@"<body>"];
NSString *originalString = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.makepartsfast.com/2012/09/4337/more-3d-printing-in-metals-ex-one-introduces-the-m-flex-3d-printing-system/"] encoding:NSUTF8StringEncoding error:nil];
NSScanner *scanner = [NSScanner scannerWithString:originalString];
NSString *extractedString = nil;
[scanner scanUpToString:@"<div class=\"postarea\">" intoString:nil];
[scanner scanString:@"<div class=\"postarea\">" intoString:nil];
[scanner scanUpToString:@"<div style=\"clear:both;\">" intoString:&extractedString]; …
Run Code Online (Sandbox Code Playgroud) 我有一个字符串:
http://feedproxy.google.com/~r/MakePartsFast/~3/1dZEOLADapg/
我想用这个字符串加载html页面.但由于字符串中的"/",我得到的URL为null.
我的代码如下:
NSURL *ur=[NSURL URLWithString:Mystring];
NSLog(@"%@",ur); //getting null value
NSURLRequest *requestObj = [NSURLRequest requestWithURL:ur];
NSLog(@"%@",requestObj);
Run Code Online (Sandbox Code Playgroud)
那么,我如何从字符串中删除最后一个"/"?
我在我的应用中实现了地图视图.
我实现了一个didselect注释方法.
在这个方法中,我打开一个popover.它工作正常.但是当弹出窗口被忽略并尝试再次单击注释时,则不再调用方法.
如果我点击其他注释,除了先前选择注释,然后方法将被调用.
我的代码如下:
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)aView {
ReadingDatabaseAppDelegate *appDelegate = (ReadingDatabaseAppDelegate *)[[UIApplication sharedApplication] delegate];
if([self isPad])
{
detailsView *popUp=[[detailsView alloc] initWithNibName:@"detailsView_ipad" bundle:nil];
popView = [[UIPopoverController alloc]initWithContentViewController:popUp];
popView.delegate =self;
[popView setPopoverContentSize:CGSizeMake(400, 400)];
AnnotationImageView *myLocationImage = (AnnotationImageView *)aView;
popUp.locationID = myLocationImage.locationID;
NSLog(@"%d",popUp.locationID);
popUp.list=listdata;
detView.fromMapView = TRUE;
if (appDelegate.preferenceRow == 1) {
detView.title = @"ATM Details";
popUp.isBranch = 0;
}
else {
detView.title = @"Branch Details";
popUp.isBranch = 1;
}
CGPoint annotationPoint = [mapView convertCoordinate:aView.annotation.coordinate toPointToView:mapView];
float boxDY=annotationPoint.y;
float …
Run Code Online (Sandbox Code Playgroud) 我正在将SQL内容(具有特殊字符,如项目符号等)插入到SQLite数据库中.
当我尝试在视图上获取内容时,它不会正确显示特殊字符.它向我展示了垃圾文本.
如何确保我在数据库中插入的任何文本都在视图中正确显示.
谢谢!
我的插入代码:
//此查询方法实现位于不同的文件中
- (NSArray *)executeQuery:(NSString *)sql arguments:(NSArray *)args {
sqlite3_stmt *sqlStmt;
if (![self prepareSql:sql inStatament:(&sqlStmt)])
return nil;
int i = 0;
int queryParamCount = sqlite3_bind_parameter_count(sqlStmt);
while (i++ < queryParamCount)
[self bindObject:[args objectAtIndex:(i - 1)] toColumn:i inStatament:sqlStmt];
NSMutableArray *arrayList = [[NSMutableArray alloc] init]; // By Devang
int columnCount = sqlite3_column_count(sqlStmt);
while ([self hasData:sqlStmt]) {
NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
for (i = 0; i < columnCount; ++i) {
id columnName = [self columnName:sqlStmt columnIndex:i];
id columnData …
Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我显示了一个日期选择器,但它也显示了以前的日期.
我只想在今天的日期显示日期.
我永远不想在Date-picker中显示今天的旧日期.
ios ×13
iphone ×10
objective-c ×10
xcode ×7
cocoa-touch ×2
html ×2
nsstring ×2
adhoc ×1
datepicker ×1
facebook ×1
file-upload ×1
httprequest ×1
image ×1
itunes ×1
mkmapview ×1
phone-number ×1
sqlite ×1
uicolor ×1
uitableview ×1
uiwebview ×1