xcode4

How to Enable Guard Malloc

会有一股神秘感。 提交于 2019-12-07 09:41:08
问题 This is a stupid question. The documentation says: To enable debugging using Guard Malloc, choose the Run > Enable Guard Malloc option in Xcode before running your project. Building and running your application with this option enabled runs your application using the Guard Malloc library automatically. You can use this option both Mac OS X applications and also for iPhone applications running in the simulator. http://developer.apple.com/library/ios/#documentation/Performance/Conceptual

How to send UIImage in JSON format, by filling a NSDictionary

折月煮酒 提交于 2019-12-07 07:05:19
问题 I'm trying to send data to a server with JSON. I am able to create my NSDictionary with my objects and key parameters. But I want to send my picture, and the picture is UIImage. NSDictionary* mainJSON = [NSDictionary dictionaryWithObjectsAndKeys: @"John", @"First_Name", @"McCintosh", @"Last_name", <HERE I WANT PICTURE>, @"Profile_picture", nil]; // Here I convert to NSDATA NSData * jsonData = [NSJSONSerialization dataWithJSONObject:mainJSON options:NSJSONWritingPrettyPrinted error:&error]; //

Include/exclude resources depending on scheme

拜拜、爱过 提交于 2019-12-07 06:30:53
问题 I have some large resources that I only need for my simulator runs—I'd like to have them automatically excluded from all device builds. Is there any way to do this with Xcode 4 short of custom build scripts that copy the resources? 回答1: I went with a Run Script phase with the following: if [ ${PLATFORM_NAME} != "iphonesimulator" ]; then echo "device build -- removing resources..." rm "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/test_a.mp3" rm "${TARGET_BUILD_DIR}/${UNLOCALIZED

How do I create a custom UITableViewCell with nib in Xcode 4?

ⅰ亾dé卋堺 提交于 2019-12-07 06:16:58
问题 In Xcode 3, I could elect to make a nib when creating a table view cell subclass. In Xcode 4, it only makes the h / m files. How do I make the subclass with a xib file? Edit: see screen shots below: EDIT: Additionally, is there any way to create the UITableViewCell nib automatically, along with the h and m files, all pre-wired and ready to edit? 回答1: This blog post describes, how to add it manually. in iOS4+, the line NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@”CustomCell” owner:self

Input to console in Xcode 4

坚强是说给别人听的谎言 提交于 2019-12-07 06:13:23
问题 I upgraded to Xcode 4 recently. Love the IB integration; hate pretty much everything else. Anyway, maybe it's just me going crazy, but I can't seem to be able to input anything into the GDB command line (can you even open the console other then as the output window or through the Log navigator??). Anybody has a solution? Hoping it's just me being stupid here... 回答1: To view output & type commands for GDB, make sure the output window is open. In the top-right of Xcode 4 you have 3 groups of

Incompatible pointer types Xcode

♀尐吖头ヾ 提交于 2019-12-07 05:53:54
问题 Semantic Issue: Incompatible pointer types initializing NewCustomCell * with an expression of type UITableViewCell * static NSString *cellID = @"customCell"; NewCustomCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; 回答1: [tableView dequeueReusableCellWithIdentifier:cellID] returns an object with type UITableViewCell * . If you know that the cell will always be of type NewCustomCell * , then you can tell the compiler to expect that with a cast. Like so: NewCustomCell *cell =

How to make customUI objects in xcode 4 for iPhone

不羁的心 提交于 2019-12-07 03:54:00
问题 I want to know how to make custom UI objects in iPhone ? 回答1: You can't do custom objects for iPhone development yet. That's for Mac development. The closest you can get is to program your own custom component based on a UIView, then place a UIView in IB and change the type to your custom component. It will then let you do any wiring needed and at runtime will embed an instance of your own class. You cannot see the component in IB though, only an empty UIView.... 来源: https://stackoverflow.com

How do I convert my Xcode project to use ARC (Automatic Reference Counting)?

℡╲_俬逩灬. 提交于 2019-12-07 03:13:29
问题 When I run Convert to Obj-C it firsts runs a Precheck. Some files I want the Precheck to ignore, and I thought I could set the compiler flag -fno-objc-arc on those files. But Precheck phase seems to ignore that flag (and reset it)...so I don't really know how to get beyond Precheck. 回答1: The first step of the pre-check has a list of all your files with checkboxes before them, just unstick the ones you do not want to convert to ARC, the migration tool will take care of setting the correct

Why doesn't UIScrollview have an accessibility area in the Interface Builder?

可紊 提交于 2019-12-07 03:09:25
问题 I've noticed that a UIScrollView doesn't have mentioned accessibility area where I can set accessibility label or accessibility. This seems to apply for activity indicators too. Why does UIVIews, UIButtons and more have this area and not UIScrollView and UIActivityIndicatorView? 回答1: Good question - the reason for a scroll view is that Apple don't consider it to be an accessible element. If you look at the UIAccessibility documentation, you'll find Apple have the following to say on what

What does selecting CALayer in View Effects Inspector inside Interface Builder do?

白昼怎懂夜的黑 提交于 2019-12-07 03:08:06
问题 Inside IB, in View Effects Inspector, there is an option to set Core Animation Layer. If I set it what does it do? Is it equivalent to setWantsLayer:YES ? If so then as per Apple docs setWantsLayer can be called before or after setLayer: . The order that setWantsLayer: and setLayer: are called is important, it makes the distinction between a layer-backed view and a layer-hosting view. If I set CALayer from IB, which order would it be? 回答1: The checkbox makes your view layer-backed (like