在我的iPhone应用程序中,我使用以下代码来查找文件的大小.即使该文件存在,我看到的大小为零.谁能帮我?提前致谢.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *URL = [documentsDirectory stringByAppendingPathComponent:@"XML/Extras/Approval.xml"];
NSLog(@"URL:%@",URL);
NSError *attributesError = nil;
NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:URL error:&attributesError];
int fileSize = [fileAttributes fileSize];
Run Code Online (Sandbox Code Playgroud) 如何以UITextField编程方式设置边框样式?
我正在创建我的文本字段:
UITextField *tfText = [[UITextField alloc] initWithFrame:CGRectMake(65, 200, 200, 30)];
tfText.backgroundColor = [UIColor colorWithRed:0.2 green:0.9 blue:0.5 alpha:0.3];
tfText.textAlignment = UITextAlignmentCenter;
[self.view addSubview:tfText];
[tfText release];
Run Code Online (Sandbox Code Playgroud) 如何比较两个不同的日期以找出哪个日期更晚?例如,date1我将在下载一些数据后存储一个日期,然后date2,我将存储当前日期.然后我需要检查哪一个更大/更晚:类似的东西if(date1>date2).
对于iPhone应用程序,如何以编程方式创建选项卡视图?任何人都可以通过提供一些很好的教程链接或示例来帮助我吗?
每一个人
在xcode4中我可以在哪里获得选项"在项目中查找文本"我的意思是我需要在整个项目中找到一个变量,比如我们在xcode3中通过右键单击变量 - >在项目中查找 - >作为文字
提前
每一个人
我需要在现有表中添加一列,以便如何通过obj c在sqlite数据库中更改表,我使用以下代码以相同的方式将数据插入表中如何编写updata表方法
- (void) InsertRecord {
if(addStmt == nil) {
const char *sql = "insert into tbl_Users(FirstName,MiddleName) Values(?,?)";
if(sqlite3_prepare_v2(database, sql, -1, &addStmt, NULL) != SQLITE_OK)
NSAssert1(0, @"Error while creating add statement. '%s'", sqlite3_errmsg(database));
}
sqlite3_bind_text(addStmt, 1, [strFirstName UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(addStmt, 2, [strMiddleName UTF8String], -1, SQLITE_TRANSIENT);
//sqlite3_bind_text(addStmt, 3, [strLogin UTF8String], -3, SQLITE_TRANSIENT);
if(SQLITE_DONE != sqlite3_step(addStmt))
NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(database));
else
//SQLite provides a method to get the last primary key inserted by using sqlite3_last_insert_rowid
//productID = …Run Code Online (Sandbox Code Playgroud) 每一个人
我已经在xcode4中创建了一个示例项目(hello world)但是我无法在iphone(ios 3.1.3)上安装它,即使我选择了部署目标3.1.3(代码签名都是正确的)
我正在安装时跟随控制台2011-04-13 13:01:37.868 prjTest [244:207] * - [UIWindow setRootViewController:]:无法识别的选择器发送到实例0x119cd0 2011-04-13 13:01:37.885 prjTest [ 244:207]由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:'** - [UIWindow setRootViewController:]:无法识别的选择器发送到实例0x119cd0'2011-04-13 13:01:37.902 prjTest [244:207] Stack:(843263261, 825818644,843267069,842763033,842725440,9545,843742792,843741800,844074496,844072508,844071060,860907492,843011371,843009055,843738120,843731504,9401,9324)在抛出'NSException'实例后终止被调用
ios ×5
objective-c ×5
cocoa-touch ×2
iphone ×2
xcode4 ×2
filesize ×1
nsdate ×1
sqlite ×1
uitabview ×1
uitextfield ×1