小编Sam*_*mar的帖子

如何从iPhone的文档目录中读取pdf文件?

目前我在iPhone应用程序中工作,我在资源文件夹(本地pdf文件)中有一个pdf文件,然后我成功读取了pdf文件(paper.pdf),下面我提到了阅读本地pdf文件供您参考.

例:

CFURLRef pdfURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("paper.pdf"), NULL, NULL);
pdf = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);
CFRelease(pdfURL);
Run Code Online (Sandbox Code Playgroud)

然后我试图在NSDocument目录中存储pdf文件(来自URL),成功存储.

NSData *pdfData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://www.msy.com.au/Parts/PARTS.pdf"]];

 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
 NSString *documentsDirectory = [paths objectAtIndex:0]; 
 NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"myPDF11.pdf"];
 [pdfData writeToFile:filePath atomically:YES];
Run Code Online (Sandbox Code Playgroud)

然后我尝试读取该pdf文件(来自NSDocument目录),但我不知道,请帮助我.

提前致谢

iphone multithreading pdf-reader ios nsdocumentdirectory

4
推荐指数
2
解决办法
1万
查看次数

如何刷新iPhone中的NSLocale?

我目前正在使用iPhone应用程序,使用NSLocale使当前的货币符号正常工作,但是当我按下主页按钮时,应用程序进入后台进程并更改货币(设置>>国际>> ​​Regionformat >>像美国,印度等...)以这种方式,然后从背景打开该应用程序货币符号没有改变,但我导航到另一个屏幕然后来到前一个屏幕只有货币改变,但我想当我从背景打开应用程序,然后货币符号自动更改.如何解决这个问题?我需要你的帮助

谢谢

我试过这里的代码:

NSLocale *theLocale = [NSLocale currentLocale];
Getdollarsymbol = [theLocale objectForKey:NSLocaleCurrencySymbol];
NSString *Code = [theLocale objectForKey:NSLocaleCurrencyCode];
Run Code Online (Sandbox Code Playgroud)

iphone currency refresh ios nslocale

3
推荐指数
1
解决办法
2444
查看次数

如何在iphone中设置NSDictionary中的数组值和键?

这里我使用NSMutableArray存储日期,然后我尝试设置键并在字典中分配ArrayValue但应用程序崩溃了,请帮助我

提前致谢

 Here i tried the code for your reference:

  [DateArray addObject:dateString]; //NSMutablArray 
  NSMutableDictionary *myDictionary =[[NSMutableDictionary alloc]init];         
  [myDictionary setObject:DateArray forKey:@"Date"]; //put array value and set key in NSDictionary.
Run Code Online (Sandbox Code Playgroud)

iphone object nsdictionary nsmutablearray ios

3
推荐指数
1
解决办法
2万
查看次数

如何在iPhone中获取设备位置名称?

目前我在iPhone应用程序中工作,使用CLLocationManager获取纬度和经度值.我不知道这个?如何从此纬度和经度值获取设备位置(地址)名称?请帮我

提前致谢

我试过这个:

- (void)viewDidLoad
{
    [super viewDidLoad];

    LocationManager = [[CLLocationManager alloc]init];
    LocationManager.delegate=self;
    LocationManager.desiredAccuracy = kCLLocationAccuracyBest;
    [LocationManager startUpdatingLocation];
}

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
    NSString * latitude = [[[NSString alloc] initWithFormat:@"%f", newLocation.coordinate.latitude]autorelease];
    NSString * longitude = [[[NSString alloc] initWithFormat:@"%f", newLocation.coordinate.longitude]autorelease];

    [LocationManager stopUpdatingLocation];

    NSLog(@"latitude:%@",latitude);
    NSLog(@"longitude:%@",longitude);
}
Run Code Online (Sandbox Code Playgroud)

iphone gps location ios

3
推荐指数
2
解决办法
2245
查看次数

如何在iphone中的NSString中删除("")双引号char?

可能重复:
如何从NSString中删除引号?

目前我正在使用iphone应用程序,这里我使用的是NSXmlparser来解析xml文件,值来的城市名称是NSString中的"墨尔本",我想删除左右双引号,请任何一个帮助这些

谢谢

我试过这里:

myString = @"Melbourne";
NSString *Replace =[myString stringByReplacingOccurrencesOfString:@""" withString:@""];
Run Code Online (Sandbox Code Playgroud)

iphone replace ios

2
推荐指数
1
解决办法
7475
查看次数

如何从iPhone中的AVAudioPlayer获取持续时间(HH:MM:SS)?

dur目前我在iPhone应用程序中工作,使用AVAudioPlayer在我的应用程序中播放音频文件,然后从中获取持续时间值AVAudioPlayer.

我得到的持续时间值如下:252.765442.

但我想要HH/MM/SS 02:52:76.

如何转换这个,请帮帮我

提前致谢..

我试过这个:

audioPlayer =  [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:tempFilePath] error:&err];
    [audioPlayer setDelegate:self];
    [audioPlayer prepareToPlay];

    float duration = (float)audioPlayer.duration;
    NSLog(@"duration:%f",duration);
Run Code Online (Sandbox Code Playgroud)

iphone duration avaudioplayer

2
推荐指数
1
解决办法
4354
查看次数

如何自动允许iPhone中的当前位置?

我正在使用iPhone应用程序,CLLocationManager用于开发我的应用程序,当我运行应用程序时,它显示一个警报视图,如"想要使用您当前的位置".然后prees Ok继续它.

但我不想显示警报视图,是否可以让应用程序在没有提示的情况下跟踪用户的位置?

提前致谢

在此输入图像描述

iphone notifications uialertview cllocationmanager ios

2
推荐指数
1
解决办法
1066
查看次数

如何在Dropbox iPhone应用程序中集成Logout功能?

我正在使用iPhone中的Drop box应用程序,使用Dropbox_SDK开发此应用程序,我已经从我的dropBox帐户上传和下载文件,它的工作正常.然后我试图在iPhone中注销Dropbox帐户,但我不知道那个集成,怎么做?

- (void)viewDidLoad
{
    UIButton *Logout =[[UIButton buttonwithtype:UIButtonTypeRoundedRect];
    Logout.frame=cgrectmake(10,10,100,50);
    [Logout setTitle:@"Log Out" Forstate:UIControlStateNormal];
    [Logout addTarget:self action:@selector(Method)ForcontrolEvent:UIControlEventTouchUpInside];
    [Self.view addsubview:Logout];
}

-(void)Method
{

    //Logout Integration

}
Run Code Online (Sandbox Code Playgroud)

api dropbox logout ios

1
推荐指数
1
解决办法
1133
查看次数

如何在 MySQL 中使用过程验证用户登录?

目前我正在验证用户登录,因此使用程序将用户名和密码与注册表格表进行比较,然后找到记录集值 >0(成功)或 <0(失败),但我在程序概念方面不是很好,我尽我所能,但我无法解决这个问题,请帮助我。提前致谢

在这里我试过这个:

Create table signupform (username varchar(10), password varchar(10)); 
Insert into signupform values ('sampath','s96000');
Insert into signupform values ('yuvaraj','y96297');
select * from signupform;

// CREATE PROCEDURE for compare username and password
create procedure testing (@username varchar(10), @password varchar(10))
AS
BEGIN
select * from signupform where username = @username and password = @password
End;
Run Code Online (Sandbox Code Playgroud)

mysql sql stored-procedures

0
推荐指数
1
解决办法
9963
查看次数

具体用户下载ios app,有可能吗?

我的一个客户希望仅限制特定用户下载iOS应用程序,是否可以这样做?

ios

0
推荐指数
1
解决办法
106
查看次数