在iphone中可扩展的tableView

我想使这种types的可展开/可折叠的表视图。 图中有类别和子类别。 例如“健康和美丽”是一个类别,当我点击这个细胞比它的开放子类如下图所示。 那么我怎样才能使这种types的表视图? 请给我build议。

在swift iOS中的屏幕截图?

有谁知道我怎么可以从我的屏幕截图通过代码(在迅速),并保存它? 我可以截图并保存为图像吗? 我看了,我看到这个代码,但我不能使用它(我认为),因为它什么都不做。 var screen:UIScreen = UIScreen.mainScreen() snapshotVieww = screen.snapshotViewAfterScreenUpdates(false) UIGraphicsBeginImageContextWithOptions(screen.bounds.size, false, 0); snapshotVieww.drawViewHierarchyInRect(view.bounds, afterScreenUpdates: true) var image:UIImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); provino = UIImageView(image: image) 先谢谢你!

目标C – 从今天(明天)开始第二天

我如何检查一个date是否固有地TOMORROW? 我不想在今天这样的日子上增加几个小时或者任何东西,因为如果今天已经是22:59 ,那么增加太多的时间会在一天之后结束,如果时间是12:00那么增加得太less会明天错过。 我怎样才能检查两个NSDate并确保其中一个相当于明天呢?

在iOS 8上按下音量上/下button的最简单的方法

在iOS 8上捕捉音量上/下button的最好/最干净的方式是什么? 理想情况下,我想捕捉按键,并防止系统音量改变(或者至less防止音量改变HUD显示)。 有一些旧的答案,使用不推荐使用的方法,并且在iOS 8上似乎不工作。这个iOS 8特定的一个也没有工作。 这个RBVolumeButtons开源类似乎也不能在iOS 8上工作。

只有横向应用程序中的GameCenter身份validation会引发UIApplicationInvalidInterfaceOrientation

问题:如果用户没有login到GameCenter帐户 – GameCenter身份validation视图以纵向模式启动(在ios 5中有一个模式对话框)要求login。但是,如果我在xcode(项目摘要)或supportedInterfaceOrientationsForWindow禁用纵向模式: (因为我的应用程序应该只在横向模式下运行)我得到: 由于未捕获exception“UIApplicationInvalidInterfaceOrientation”而终止应用程序,原因:“支持的方向与应用程序没有共同的方向,并且shouldAutorotate返回YES” 如果我启用肖像的iPad / iPhone(和/或注释supportedInterfaceOrientationsForWindow :)它的工作原理没有崩溃,但我不想纵向模式启用。

使用NSMutableString附加到文件的末尾

我有一个日志文件,我试图追加数据的结尾。 我有一个NSMutableString textToWritevariables,我正在做以下几点: [textToWrite writeToFile:filepath atomically:YES encoding: NSUnicodeStringEncoding error:&err]; 但是,当我这样做时,文件内的所有文本都被replace为textToWrite中的文本。 我怎样才能追加到文件的末尾? (或者甚至更好,我怎样才能追加到文件的最后一行?)

在iphone中保存图像数据到sqlite数据库

我想保存图像数据到我的sqlite数据库,但我不能这样做… – (void) SaveData: (Article*) article :(NSMutableArray*) rssList { sqlite3_stmt *statement; if (sqlite3_open([self.dataBasePath UTF8String], &articlesDB) == SQLITE_OK) { NSString* sqlFormat = @"INSERT INTO ARTICLES (guid, title, summary, mainLink, pubDate, author, imageLink, body, favorites, smallImage) VALUES ('%@', '%@', '%@', '%@', '%@', '%@', '%@', '%@', '%@', ?)"; // Correct summary. NSString* summary = [NSString stringWithString:article.summary]; summary = […]

在iphone中发布图像到服务器

我想从iphone发布/共享图像到服务器。 图像准备分享。 我正在使用大多数网站使用下面的代码显示的方式 NSData *imageData = UIImageJPEGRepresentation(image, 100); NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; [request setHTTPMethod:@"POST"]; NSString *boundary = @"0x0hHai1CanHazB0undar135"; NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary]; [request setValue:contentType forHTTPHeaderField:@"Content-Type"]; NSMutableData *body = [NSMutableData data]; [body appendData:[[NSString stringWithFormat:@"\r\n–%@\r\n",boundary] dataUsingEncoding: NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"imageToAttach\"; filename=\"%@\"\r\n",fileName]dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithFormat:@"Content-Type: image/jpeg\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:imageData]; [body appendData:[[NSString stringWithFormat:@"\r\n–%@–\r\n",boundary] […]

在WatchOS2中使用WatchConnectivity在iOS和WatchOS之间发送消息

我观看了WWDC2015,看到您现在可以在手表上开发原生应用程序。 这开辟了很多的function,我想知道如何可以在我的iOS应用程序和我的AppleWatch应用程序之间发送数据。 我看到有一个名为WatchConnectivity的新框架。 我怎样才能使用这个function,来回发送数据时有什么select?

我如何从SKScene展示一个UIViewController?

我正在通过Sprite Kit进入iOS,我认识到这是不明智的。 我的目标是在游戏结束后显示“分享”button。 点击分享button应呈现一个SLComposeViewController(Twitter的份额)。 现场的内容不应该改变。 指示“Game Over”的游戏逻辑位于SKScene的子类SpriteMyScene.m中。 我可以在游戏上显示Sharebutton -(void)update:(CFTimeInterval)currentTime { if (gameOver){ UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [button addTarget:self action:@selector(sendToController) forControlEvents:UIControlEventTouchDown]; [button setTitle:@"Show View" forState:UIControlStateNormal]; button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0); [self.view addSubview:button]; } } – (void)sendToController { NSLog(@"ok"); SpriteViewController *viewController = [SpriteViewController alloc]; [viewController openTweetSheet]; } 我卡住的地方是试图让showTweetButton方法工作。 我的SpriteViewController.m看起来像这样: – (void)openTweetSheet { SLComposeViewController *tweetSheet = […]