cocoa-touch

Threaded NSTimer

这一生的挚爱 提交于 2019-12-31 04:25:06
问题 I am aware of the many questions regarding this topic, as I myself have asked one previously however, my issue now seems to be more related to the threading part. I have the following 2 methods. -(void) restartTimer { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; self.timer = [NSTimer scheduledTimerWithTimeInterval:1. target:self selector:@selector(dim) userInfo:nil repeats:YES]; time = 31; NSLog(@"calling restart timer"); [self performSelectorOnMainThread:@selector

Reset array after playing the game?

耗尽温柔 提交于 2019-12-31 04:13:29
问题 I made a quiz in iOS with xcode, what i have now is a quiz that generates 20 random answers out of an array, it controls the text of the labels when a button is pushed to check if the answer is correct. The answers are also random generated and i made sure that there weren't mulple answers with the same text. My problem is that when a question is asked, i change the text of an object in my array to "removed"; but when i push start again after i've done the quiz, my array has 20 objects with

“Application windows are expected to have a root view controller” conditional appearance

旧时模样 提交于 2019-12-31 04:09:28
问题 I'm writing an app for iPhone using Xcode 4.5 and iOS6. I'm also creating a new UIWindow to be able to manage the area of the status bar (to display messages there, etc.) I'm using storyboards and my appDelegate method looks like this: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { return YES; } The message does not appear in the console when I put it in the method called viewDidAppear : - (void)viewDidAppear:(BOOL)animated { if

Import csv data (SDK iphone)

流过昼夜 提交于 2019-12-31 04:06:08
问题 For the following code, I can read all the data in the string, and successfully get the data for plot. NSMutableArray *contentArray = [NSMutableArray array]; NSString *filePath = @"995,995,995,995,995,995,995,995,1000,997,995,994,992,993,992,989,988,987,990,993,989"; NSArray *myText = [filePath componentsSeparatedByString:@","]; NSInteger idx; for (idx = 0; idx < myText.count; idx++) { NSString *data =[myText objectAtIndex:idx]; NSLog(@"%@", data); id x = [NSNumber numberWithFloat:0+idx*0

iOS search bar not showing results

青春壹個敷衍的年華 提交于 2019-12-31 04:04:30
问题 *Update: This actually works, the style for my custom cell hasn't come across and so the cell looks blank. How then do I get the searchResultsTableView to use my custom cell? I have implemented a search bar in my table view. Searching, filtering all work when I debug, but when I enter characters into the search bar, the results do not load or show. This is everything I'm doing: @interface InviteTableViewController ()<UIAlertViewDelegate, UISearchBarDelegate, UISearchDisplayDelegate> @property

local notifications?

假装没事ソ 提交于 2019-12-31 03:56:14
问题 My application is primarily a client for a server that really doesn't have a connection to the internet. It connects to a Polycom codec and manages the video calls between 2 endpoints. So my application can send commands like end call, volume up, etc... However my problem is this. I need some kind of notification when an incoming call happens and the application is not in the foreground. Since the server does not have internet access APNS/push notifications will not work for me. I have looked

How to use different interface declarations at compile time without confusing Interface Builder

十年热恋 提交于 2019-12-31 03:22:06
问题 If I have multiple builds of my app, paid and free versions, for example, and I want to have different interfaces depending on which build, it seems to confuse Interface Builder. For example: // MyViewController.h #ifdef FREE @interface MyViewController : NSObject <UIActionSheetDelegate, ADBannerViewDelegate> #else @interface MyViewController : NSObject <UIActionSheetDelegate> #endif { IBOutlet UILabel* myLabel; } - (IBAction) myAction:(id)sender; When I load up MyViewController.xib in IB, it

Retrieving device WiFi MAC address with iOS 7

自作多情 提交于 2019-12-31 03:19:12
问题 Our app is using device WiFiMAC address to uniquely identify a device. As per the Apple doumentation we shall start using identifierForVendor property of UIDevice but my app is strongly dependent on WiFi MAC address. At run time, app users look into device settings and fetch the WiFi Mac address and manually put them in some tool to enable some feature on server side. Has anyone retrieved the device WiFi MAC address with iOS 7? 回答1: This was intentionally removed from the SDK in iOS 7. You

UISearchController search bar doesn't get focus

微笑、不失礼 提交于 2019-12-31 02:26:06
问题 In my project, If a controller (containing UISearchController) is pushed second time on to the navigation stack, Search bar can't seem to get focus. The following GIF recoding demonstrates what I am talking about: As you can see, when search screen is pushed to the navigation stack the second time (by tapping the magnifying glass), I can't tap in the search bar anymore. Code to reproduce the issue: If you'd like to look at the code, You can download the minimal project. 回答1: You need to set

GHUnit error file _OBJC_CLASS_$_SenTestCase", referenced

烂漫一生 提交于 2019-12-31 02:17:26
问题 I'm using GHUnit in my project but when i try to run the app it gives errors Ld /Users/goldfire/Library/Developer/Xcode/DerivedData/WhatsMySpeed-amkgqintxyhelabqvrpouivmdglf/Build/Products/Debug-iphonesimulator/GHUnitTests.app/GHUnitTests normal i386 cd /Users/goldfire/Desktop/Example/WhatsMySpeed setenv MACOSX_DEPLOYMENT_TARGET 10.6 setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin: