UISearchController在继续之后保持

我有一个UISearchController的应用程序。 用户界面的这个元素完全是这样设置的: searchController = UISearchController(searchResultsController: nil) searchController.searchResultsUpdater = self searchController.searchBar.delegate = self searchController.dimsBackgroundDuringPresentation = false searchController.hidesNavigationBarDuringPresentation = false searchController.searchBar.searchBarStyle = UISearchBarStyle.Minimal searchController.searchBar.frame = CGRectMake(searchController.searchBar.frame.origin.x, searchController.searchBar.frame.origin.y, searchController.searchBar.frame.size.width, 44.0) 然后我把它添加到我的tableView的tableHeaderView tableView.tableHeaderView = searchController.searchBar 一切似乎工作正常,但是当它是活跃的,我在我的tableView中select一个项目,我的应用程序继续到另一个视图控制器的search控制器坚持视图。 我不确定如何这是可能的,因为search控制器应该是另一个视图控制器中的表视图的子视图。 我怎样才能防止这种情况发生?

为UIBarButtonItem设置图像 – 图像拉伸

当我尝试使用UIBarButtonItem的“initWithImage”来初始化一个导航栏的自定义图像时,它会在黑色的导航栏上显现出来,并被拉伸。 这是我创build它的方式: UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"gear.png"] style:UIBarButtonItemStyleBordered target:self action:@selector(showSetting:)]; 这是它的样子: 任何想法,如果这是一个问题的形象? 我从我买的一套图标中得到了它。

使SKScene的背景透明不工作…这是一个错误?

有没有办法让SKScene的背景透明,并通过透明度来呈现另一个场景。 这个想法是有这样的场景的背景: self.backgroundColor = [SKColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.5f]; 什么可以让背后的景象变暗。 但是这样做是行不通的。 背景呈现完全不透明。 有没有办法做到这一点?

IOS Facebook的SDK – 发布打开graphics和时间轴上显示,无需点击活动日志

从Facebook SDK示例代码中,当成功将打开的graphics对象发布到时间线时,必须单击Facebook网站上的活动日志中的在时间线上显示 。 如何忽略这些步骤,并明确地将您的OG分享给时间表? —————————————- 以下答案: —— ———————————- 只需添加一个代码到你的FBOpenGraphAction对象: id<FBOpenGraphAction> action = (id<FBOpenGraphAction>) [FBGraphObject graphObject]; [action setObject: @"true" forKey: @"fb:explicitly_shared"]; // This is the key point! 您应该在网站上的Facebook开发者应用程序面板中为开放graphics操作启用“显式共享”设置。 有关更多详细信息,请查看关于显式共享的文档

如何在Swift中使用Objective-C代码和#definemacros

我正在尝试在我的Swift项目中使用第三方的Objective-C库。 我已经成功地将库导入到了Xcode中,并且创build了一个<Project>-Bridging-Header.h文件,允许我在Swift中使用Objective-C类。 我似乎遇到了一个问题:Objective-C代码包含一个带有macros#define AD_SIZE CGSizeMake(320, 50)的macros的Constants.h文件。 将Constants.h导入我的<Project>-Bridging-Header.h不会导致我的Swift应用程序可以使用的全局常量AD_SIZE 。 我做了一些研究,看到“复杂的macros”下面的苹果文档说 “在Swift中,可以使用函数和generics来获得与复杂macros相同的结果,而不会有任何妥协。 因此,C和Objective-C源文件中的复杂macros不能用于Swift代码。“ 读完之后,通过在Swift中指定let AD_SIZE = CGSizeMake(320, 50) ,我可以很好地工作,但是如果这些值在我不知情的情况下改变,我想保持与库的未来兼容性。 有没有一个简单的解决这个在Swift或我的桥接头? 如果没有,是否有办法replaceConstants.h的#define AD_SIZE CGSizeMake(320, 50) ,并保持与使用旧的AD_SIZEmacros的现有Objective-C应用程序向后兼容?

如何在scrollToRowAtIndexPath完成animation时得到通知

这是如何在tableViewController完成animation推送到导航堆栈时得到通知的后续操作。 在tableView我想取消select一个包含animation的行,但只有在tableView 完成将滚动animation到所选行​​之后。 如何在发生这种情况时得到通知,或者在结束的时候调用什么方法。 这是事物的顺序: 推视图控制器 在viewWillAppear我select一个特定的行。 在viewDidAppear我scrollToRowAtIndexPath (到选定的行)。 然后,当滚动完成后,我想deselectRowAtIndexPath: animated:YES 这样,用户就会知道他们为什么在那里滚动,但是我可以淡出select。 第四步是我还没有弄清楚的部分。 如果我在viewDidAppear调用它,那么在tableView滚动到那里时,行已经被取消select了,这是不好的。

如何在文档文件夹中保存创build的PDF并在iOS中合并

更新我能够在iPHone中创build单独的带有注释的照片的PDF页面。 点击button时,我每次都会生成一个PDF页面,而我希望那些PDF页面在单个PDF页面中。 我无法将单个PDF文件合并在一起。 http://mobile.tutsplus.com/tutorials/iphone/generating-pdf-documents/?search_index=3 我已经按照上面的url代码。 你能在这里提出一些逻辑吗? 提前致谢。 * 在代码编辑 *你可以检查下面的代码。 – (IBAction)didClickOpenPDF { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *pdfPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.pdf",myPDFName]]; if([[NSFileManager defaultManager] fileExistsAtPath:pdfPath]) { ReaderDocument *document = [ReaderDocument withDocumentFilePath:pdfPath password:nil]; if (document != nil) { ReaderViewController *readerViewController = [[ReaderViewController alloc] initWithReaderDocument:document]; readerViewController.delegate = self; readerViewController.modalTransitionStyle […]

如何在UIScrollView中使用UITableView并接收单元格单击?

我有我的应用程序中显示为一个单独的屏幕DiscountListTableViewController 。 但还有另一个屏幕( PlaceDetailsViewController ),我需要在底部显示相关的折扣。 目前, PlaceDetailsViewController.view具有UIScrollView作为一个容器,我将DiscountListTableViewController.tableView添加到PlaceDetailsViewController viewDidLoad中的这个UIScrollView.content容器。 这工作和表视图显示正确,但无法接收单元格点击。 我知道UITableView从UIScrollViewinheritance,它不知道(但不是限制)。 但是,从松耦合的angular度来看,每个组件都应该被devise成可以在别处独立使用的一种方式,在我的情况下,它是DiscountListTableViewController 。 PlaceDetailsViewController组件仅仅需要DiscountListTableViewController ,所以没有理由不能直接使用它。 有什么build议么?

在Swift中使用imagePickerController在同一视图控制器中select两个不同的图像

我正在做一个应用程序,其中有两个UIImageViews。 在每个图像视图中,用户需要能够input不同的图像。 这是我到目前为止的代码。 var imagePicker = UIImagePickerController() @IBAction func chooseImage1(sender: AnyObject) { if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum){ println("Button capture") imagePicker.delegate = self imagePicker.sourceType = .SavedPhotosAlbum imagePicker.allowsEditing = false self.presentViewController(imagePicker, animated: true, completion: nil) } } @IBAction func chooseImage2(sender: AnyObject) { if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum){ println("Button capture") imagePicker2.delegate = self imagePicker2.sourceType = .SavedPhotosAlbum imagePicker2.allowsEditing = false self.presentViewController(imagePicker, animated: true, completion: nil) […]

打字机效果文本animation

我试图用UILabel创build一个打字机animation效果,但是找不到任何答案。 UILabel是否是正确的对象? 我想要文本打印到屏幕上的string数组,如“login…打开文件夹…重新启动系统..”等我应该提到,我是新来的编码,我试过search文档和API参考,但没有运气。 如果值得一提的话,我现在正在学习SWIFT