cocoa-touch

App Store Leave a Review/Rate iOS 8 Swift

自闭症网瘾萝莉.ら 提交于 2019-12-25 00:31:09
问题 I have a cell in the settings table view where i want to send the users straight to the Appstore and open the app page so they can leave a review. There is plenty of content about that in Stackoverflow but none worked for me in iOS8 with Swift. Thanks. 回答1: if let checkURL = NSURL(string: "http://www.itunes.com/yourAppLlink.html") { if UIApplication.sharedApplication().openURL(checkURL) { println("url sucefully opened") } } else { println("invalid url") } 回答2: Try this- var path: NSURL =

CTFrameGetVisibleStringRange Incorrectly Counting Spaces at End of String?

痴心易碎 提交于 2019-12-25 00:30:07
问题 I'm working with CoreText and I notice that CTFrameGetVisibleStringRange incorrectly counts spaces at the end of the string which are NOT visible in the frame as being visible. FYI, I am adding the space as a string @" " using insertAttributedString to the end of my NSMutableAttributedString . Does anyone know how to fix this? UPDATE: Still haven't found a solution to this, is this the intended behavior? Or this just a bug? 回答1: This is a bug. To work around this replace the " " at the end of

How can i pass data back to parent view controller. am using addSubView method to show child view

隐身守侯 提交于 2019-12-25 00:14:49
问题 How can i pass data back to parent view controller. im using addSubView method to show child view. addFields = [[AddFields alloc] initWithNibName:@"AddFields" bundle:nil]; [self.view addSubview:addFields.view]; Now i want to sent data from "AddFields" view to my parent controller. How can i do that. Can anyone help me.. 回答1: One simple way to do is using NSNotificationCenter see this example Post you notification from your AddFields when you want to send the object [[NSNotificationCenter

Using addSubView or presentModalViewController in a standard method with paramaters?

自闭症网瘾萝莉.ら 提交于 2019-12-24 23:57:03
问题 I'm trying to reuse code, I have some tutorial view controllers / views, which I would like to call from an action sheet. However, the calling views are different. Sometimes the tutorial view(s) would need to be added as a subview and sometimes they would be added to the navigation controller. How can I expand my standard function to cater for these two different situations ? You can see what I'm having to do instead, which means duplicate code :( I have a class called which holds the

How to Create a Multiple Question?

雨燕双飞 提交于 2019-12-24 23:07:21
问题 I need to retrieve 6 questions from a plist and check the answer if is correct from the plist itself?? i will use a QR code scanner api to scan for answer, the api will covert to a string and read from the plist to check if the answer is correct... is there any tutorial or references for me to look @ ?? In my plist there is: question ~ Dictionary with the following strings: NumberOfOption ~ which define if the question is a multiple choice or a QR code question Question ~ question itself

UINavigationController content offset when displayed in UIPopover

◇◆丶佛笑我妖孽 提交于 2019-12-24 22:55:26
问题 I have a view which I load into a UINavigationController and present either as a popover on iPad or a modal view on iPhone. The weirdness I'm experiencing is that, when this nav is presented in the popover, it's content appears offset, or pushed down, by about 60 pixels. Below are screenshots of this phenomenon. It currently appears this way because I have my top constraint set to 80, compensating for the iPhone. If I Set it to something more intuitive like 10 or 20, the label would be

Pass object from VC to App Delegate

为君一笑 提交于 2019-12-24 22:15:11
问题 I have a few objects in a VC that I want to be accessible from my App Delegate. My VC launches another app, which does a callback to my app. This callback triggers a method in my App Delegate: - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url But I want to access some objects in this method that I had set in that previous VC. Any ideas how? 回答1: Use +(id)sharedApplicationDelegate; in delegate.h, and write +(id)sharedApplicationDelegate{ return [[UIApplication

NSFileSystemFileNumber is changed after file is edited/updated in objective c

廉价感情. 提交于 2019-12-24 21:45:51
问题 I am working on File Management System exactly like Dropbox in Cocoa . My problem is when i edit any text file at that time NSFileSystemFileNumber is changed. I want an unique NSFileSystemFileNumber even if that edited file is moved from the particular folder. In short, I just want to know how to fetch that moved file's old or original path from the database. Any alternate way to solve out this problem? Thanks in Adv..!! 回答1: It depends on how the editor save functionality is implemented.

How to fix iPhone Simulator trying to launch a Nib that isn't there?

瘦欲@ 提交于 2019-12-24 21:03:51
问题 I'm getting this error message when I Build&Go: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] was unable to load a nib named "TestappViewController"' I created a blank new project and then started to create a RootViewController which holds two other UIViewController's. XCode automatically created the TestappViewController, and I deleted it to start totally from scratch. MainWindow.xib shows me no

move didFinishLaunchingWithOptions: method to viewcontroller method with button trigger

岁酱吖の 提交于 2019-12-24 21:02:59
问题 I had the following code working in AppDelegate.h/.m but cannot change it to work in ViewController with a button triggering it. @implementation BSViewController @synthesize imageView; @synthesize workingImage; - (IBAction) chooseImage:(id) sender { UIImage* testCard = [UIImage imageNamed:@"ipad 7D.JPG"]; CGImageRef num = CGImageCreateWithImageInRect([testCard CGImage],CGRectMake(532, 0, 104, 104)); UIGraphicsBeginImageContext(CGSizeMake( 250,650)); CGContextRef con =