cocoa-touch

iOS - Presenting a UIViewController inside anther UIViewController

馋奶兔 提交于 2020-01-05 06:39:13
问题 I dont have a very good understanding on the topic, so please bear with me I am trying to display a UIViewController inside another UIViewController. I feel like there aren't enough examples out there. I have read the documentation but being fairly new to iOS I am kind of lost. Here is my problem: I can get the child UIViewController to appear inside the parent UIViewController but the child view is not displaying right. Sorry, I cant post pictures yet. Here is my child - UIViewController.

iphone: How do I get the location of a touch down event?

核能气质少年 提交于 2020-01-05 06:14:31
问题 I have an empty View-Based app. I'd like to do something with the x,y coordinates of every touch down on the screen. How do I do this? 回答1: Override the - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event function (from the NSRespondrer class). You can override it from your view class. The 'touches' variable hold a set of 'UITouch' instances that you can query for the location in the view. 来源: https://stackoverflow.com/questions/542972/iphone-how-do-i-get-the-location-of-a-touch

Best way to implement Enums with Core Data in Swift

孤街浪徒 提交于 2020-01-05 05:24:30
问题 Very similar question to Best way to implement Enums with Core Data What is the best way to bind Core Data entities to enum values so that I am able to assign a type property to the entity? In other words, I have an entity called Item with an itemType property that I want to be bound to an enum, what is the best way of going about this in Swift ? 回答1: So far, this is my best approach. I still use the ObjC enum definition, as suggested in Daniel Eggert's answer to the same ObjC question as the

NSArray vs NSDictionary look up

老子叫甜甜 提交于 2020-01-05 04:35:13
问题 Which is quicker and less expensive for checking if an object already exists within a list. By using the NSArray contains object or by checking if a key already exists for an NSDictionary? Also does the NSArray containObject selecter iterate through the whole array elements? Also what about checking if a key already exists within a dictionary? Does that require iterating through all the keys. Finally, what is the best and quickest way to check if an object already exists within a large list

CorePlot 1.0 + LLVM GCC 4.2 + ARC - How to?

我的梦境 提交于 2020-01-05 04:16:07
问题 I'm trying out CorePlot in a small personal project to draw some bar graphs. I started the project using Xcode 4.3.2 and ARC, thinking it'd make my life easier... The problem is, when using GCC 4.2 - the compiler doesn't recognise @autorelease . I got past that using: int retVal = 0; // @autoreleasepool { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; retVal = UIApplicationMain(argc, argv, nil, NSStringFromClass([kerrAppDelegate class])); [pool drain]; // } return retVal; However

Youtube integration - Warning

不羁的心 提交于 2020-01-05 04:08:13
问题 I got this warning when i ran the application on my iPhone. warning: Unable to read symbols for /Users/illep/Library/Developer/Xcode/iOS DeviceSupport/4.3.3 (8J3)/Symbols/System/Library/Internet Plug-Ins/YouTubePlugIn.webplugin/YouTubePlugIn (file not found). warning: No copy of YouTubePlugIn.webplugin/YouTubePlugIn found locally, reading from memory on remote device. This may slow down the debug session. What does it mean ? and how can i get rid of it ? 回答1: That simply means that

How do I save state with CALayers?

帅比萌擦擦* 提交于 2020-01-05 04:05:29
问题 I have a simple iphone application that paints blocks using a subclass of CALayer and am trying to find the best way to save state or persist the currently created layers. I tried using Brad Larson's answer from this previous question on storing custom objects in the NSUserDefaults, which worked for persisting my subclass of CALayer, but not it's basic state like geometry and background color, so they were there but did not render on relaunch. I made my declared instance variables conform to

How do I save state with CALayers?

こ雲淡風輕ζ 提交于 2020-01-05 04:05:09
问题 I have a simple iphone application that paints blocks using a subclass of CALayer and am trying to find the best way to save state or persist the currently created layers. I tried using Brad Larson's answer from this previous question on storing custom objects in the NSUserDefaults, which worked for persisting my subclass of CALayer, but not it's basic state like geometry and background color, so they were there but did not render on relaunch. I made my declared instance variables conform to

First and last UITableViewCell keep changing while scrolling

送分小仙女□ 提交于 2020-01-05 03:31:11
问题 I have a tableView with cells containing one UITextField as a subview for each cell. My problem is that when I scroll down, the text in the first cell is duplicated in the last cell. I can't for the life if me figure out why. I have tried loading the cells from different nibs, having the textFields as ivars. The UITextFields don't seem to be the problem, I'm thinking it has something to do with the tableView reusing the cells. The textFields all have a data source that keeps track of the text

UIPinchGestureRecognizer's touch locations

假如想象 提交于 2020-01-05 03:29:24
问题 I want to implement zooming with pinch gesture in my iphone app. The problem is, in a method that gets called when the gesture is recognized I don't have access to the touch events themselves (so I can't really get their locationInView: ) and I would like to get it in order to center my zoom-in properly. In the UIPinchGestureRecognizer class definition there is a UITouch *_touches[2]; defined, but I can't access it from outside of the class. Is there anything I can do in order to get that