xcode4.2

How to access drawrect method from UIViewController?

梦想的初衷 提交于 2019-12-11 18:10:12
问题 I am using Xcode 4.2 and have a UIViewController representing one of the scenes. In it, inside viewWillAppear i have [NSTimer scheduledTimerWithTimeInterval: FramesPerSecond target:self selector:@selector(gameLoop) userInfo:nil repeats:YES]; Inside gameLoop method, i have [[self view] setNeedsDisplay]; Problem: drawRect method is not being called (As i understand it it should be called from setNeedsDisplay Question: Is it possible to define drawRect method inside a UIViewController class and

how can i give input for UILabel in iPhone

核能气质少年 提交于 2019-12-11 18:01:54
问题 i have 2 classes . in my first class i have one label. now i have to give input for that label from my second class. here is my code. IBOutlet UILabel *label1; @property(nonatomic, retain) IBOutlet UILabel *label1; @synthesize label1; I call this label like this. I import my class1 and create object like classone. I checked( NSLog print)class and that method will be called but that input won't come.i checked that label its also connected to my class.because i give same input in my viewDidLoad

Moving UITextField up with keyboard - changes in swift 4.2?

自古美人都是妖i 提交于 2019-12-11 17:49:47
问题 I had this function to move certain textfields upwards, when the keyboards would block their view - I'm sure you all know about this: override func viewDidLoad() { super.viewDidLoad() let center: NotificationCenter = NotificationCenter.default center.addObserver(self, selector: #selector(keyboardDidShow(notification:)), name: NSNotification.Name?.UIKeyboardDidShow, object: nil) center.addObserver(self, selector: #selector(keyboardWillHide(notification:)), name: NSNotification.Name?

Xcode openURL doesn't read link

China☆狼群 提交于 2019-12-11 17:32:17
问题 I have an animal list and special button. When I press the button, I would like to go to Wikipedia and read about this animal more. So I wrote this code: -(IBAction)goWiki:(id)sender { NSString *wikiUrl = "http://ru.wikipedia.org/wiki/"; NSString *url = [NSString stringWithFormat:@"%@%@",wikiUrl,animalTitle]; [[UIApplication sharedApplication]openURL:[NSURL URLWithString:url]]; NSLog(@"%@",url); } NSLog shows that url was written correctly, however, nothing happened. I am 99,9% sure its

Loading main XIB makes app crash on iOS 3.0

我的梦境 提交于 2019-12-11 17:25:46
问题 thank you for taking some time to read my question. I have this app (In Cydia), which has around 10% of users with iOS 3.0, so I want to support them in my next update . I tested it with actual devices running, iOS 4.0 and 5.0.1; it worked fine. But on iOS 3.0 it crashes with an exception: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive (0x4e, 0x49, 0x42, 0x41, 0x72, 0x63, 0x68, 0x69)

Is this the correct way of refreshing the drawing in a different view?

≯℡__Kan透↙ 提交于 2019-12-11 15:25:39
问题 Import the CustomView.h in the data controller header file Create an IBoutlet to my CustomView from there Connect that outlet instoryboard from the DataController to the CustomView Use that to call the view's setNeedsDisplay method. Every time I add an item to the core data context I would like it to notify the CustomView (which lives in another tab) to redraw itself. I am using ios5 and storyboards. 回答1: Yep, the DataController should be notifying the view when it needs to refresh because

iPhone calculator tutorial help, decimal style..again

房东的猫 提交于 2019-12-11 13:41:20
问题 I am working on the iPhone calculator tutorial, and I am running into a problem with the display of numbers. The calculator screen "prints" the 2nd entered operand (number) right next to the first one causing some erroneous calculations as- currentNumber feeds off this string. How can i get the numbers and even the operator (+,-,*,/) to all show up and still perform the calculation correctly? - (IBAction)pressedDecimal:(id)sender { calculatorScreen.text = [calculatorScreen.text

Adding a new target in xcode 4.2

半城伤御伤魂 提交于 2019-12-11 12:45:23
问题 I am just trying to add a new target to my project in xcode 4.2. After selecting Add target option, i have n't see any External build system option in ios section.Please help me to solve this. Thanks in Advance 回答1: I've had success by creating an OS X external build system, then changing the SDKROOT under Build Settings to "iphoneos". It causes many other build settings to change magically to reasonable values for iOS. I've used this technique with success in the past with Xcode 4.0.2, and I

Error launching remote program: failed to get the task for process on xcode 4.2

寵の児 提交于 2019-12-11 11:14:28
问题 I'm having some problems debugging apps directly on my iphone. I'm using xcode 4.2 and a jailbroken ios 5.0.1 device and when trying to launch the app on my iphone from excode I get the following message: "Error launching remote program: failed to get the task for process (some number here)" But if I now try to use the app directly on the iphone it works perfectly. Does anyone know how to fix it? thank you. 回答1: For xcode 4: you have to create Entitlements.plist file from menu->File->New->New

Xcode memory leak check

馋奶兔 提交于 2019-12-11 10:34:07
问题 I need to check my iPhone application memory leaks. I went following link and I also need to check my app memory leak like that. http://www.youtube.com/watch?v=R449qEuexNs&feature=related So can Any one have any idea about how to do this on Xcode 4.2 ? Thanks a lot 回答1: In 4.2 it's under : Product -> Profile 回答2: Check with the following links: Memory leak detection tools Instruments in Xcode 4 It works for me :) 回答3: You can use shortcut key Command + i 来源: https://stackoverflow.com