cocoa-touch

Recent searches with Core Data

北城以北 提交于 2020-01-14 05:43:13
问题 I'm making a Core Data app for the iPhone, but hope the question applies enough to Mac OS X to be answered in that context with no NDA issues. When a user does a search, I am saving each result into a context using entity Entry. I want these results to be retrievable later under a Recent Searches section. What's the best way to go about this? One way I'm considering is add another entity named History with an Entry attribute linking to this. First search results would have Entry.history_id =

iPhone console for nslog?

五迷三道 提交于 2020-01-14 05:01:05
问题 How can i see nslog messages when I am testing on device? My only way right now is to have a UITextView and put message in there, there must be a better way..Thanks. I went to seetings and turned on console but still don't know how to see them. Thanks. 回答1: These calls will output to your devices system log. You'll be able to get these from the XCode Organizer when you plug your phone back in. 回答2: There are also a few apps you can install from App Store on your device (search for free ones,

Moving content of UITableViewCell on tap

旧时模样 提交于 2020-01-14 04:52:16
问题 If anyone have Google+ App can certainly understand what I'm trying to implement. ( explained here: UIViewController Containment with animation like Google+) I think it has something related with the new effect in iOS 7 Calendar App. ( explained here: Recreating iOS 7 Calendar UIView Animation) - This is a common animation effect that I'm seeing in many apps these days. Months ago, the fellow Rob tried to help me with this his answer: Now I was trying to implement it but there's a problem.

Variadic function without nil termination

岁酱吖の 提交于 2020-01-14 04:49:10
问题 I am trying to create a method like the following: - (void)setCondition:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2); But since I'm not great with preprocessor, I hit an issue that I have fixed in the following code snippet, but I'd like to know if there's not cleaner way to achieve what I want which is to stop after the provided arguments + (CRCondition *)conditionWithFormat:(NSString *)format,... { CRCondition *condition = [[CRCondition alloc] init]; NSArray *conditionSliced = [condition

Custom Navigation Bar in iOS 5

拈花ヽ惹草 提交于 2020-01-14 04:04:28
问题 I use a class to style the NavigationControllers in iOS 5. The problem I have is the moreNavigationController which is created automatically. I found a way to style the moreNavigation itself, if ([[[UIDevice currentDevice] systemVersion] intValue] >= 5.0){ [self.rootController.moreNavigationController.navigationBar setBackgroundImage: [UIImage imageNamed:@"noten_header.png"] forBarMetrics:UIBarMetricsDefault]; } but i have no clue how I style the edit view of the moreNavigationController (if

How to delay while retaining a responsive GUI on Cocoa Touch?

荒凉一梦 提交于 2020-01-14 03:09:46
问题 Basically, I have an array of buttons I want to iterate and highlight (among other things) one after another, with a delay in-between. Seems like an easy task, but I can't seem to manage to get it to work cleanly while still being responsive. I started out with this: for MyButton *button in buttons { [button highlight]; [button doStuff]; usleep(800000); // Wait 800 milliseconds. } But it is unresponsive, so I tried using the run loop instead. void delayWithRunLoop(NSTimeInterval interval) {

Showing an alert with Cocoa

独自空忆成欢 提交于 2020-01-14 01:58:08
问题 I have been using VB.NET for a while and I switched to Xcode 4. In the VB.NET environment, I used to type the following command in a button: if TextBox1.text="" then MessageBox.Show("You can't leave the textbox empty!, "Error!") else Label1.text = TextBox1.text That is just an example. In Xcode, I want to do the same thing except for I want to have a Pop-Up Alert (in the iPhone) instead of the MessageBox in VB.NET. Any Ideas? 回答1: Here you go if ([TextBox1.text isEqualToString:@""]){

How to setup a partial curl modal not hiding toolbar?

♀尐吖头ヾ 提交于 2020-01-13 20:20:07
问题 In the Google Maps app on iPhone, the toolbar in the buttom is still visible after the modal with a partial curl transition is preformed. When I setup a modal seque in my storyboard with a partial curl, the new view controller is hiding the toolbar from the parant view. How can I setup a partial curl like the Google Maps app? 回答1: You'll probably need to go with OpenGL ES for this one. Core Animation exposes the ability to work with layers, even in 3-D, but all layers are just rectangles and

How to scale up a PDF containing a vector-based graphic drawn by CGContextDrawPDFPage in Cocoa Touch

不问归期 提交于 2020-01-13 20:12:44
问题 ok so here is what I want to do: Load a PDF containing a vector graphic Scale it up Draw it to a graphics context Create a UIImage from the result and present it Everything works fine, except the fact that the graphic loses quality and looks pixelized :( Here is the code where the scaling happens: // PDF loaded before CGPDFPageRef page = CGPDFDocumentGetPage (document, 1); UIGraphicsBeginImageContext(CGSizeMake(width, height)); CGContextRef context = UIGraphicsGetCurrentContext();

Why is hitTest not being called when views subview is touched?

痞子三分冷 提交于 2020-01-13 14:13:53
问题 I have a view which I'll call parentView which has a subview called childView . Part of childView is outside the bounds of parentView , and childView has a panGestureRecognizer attached to it. I have implemented the following in parentView so that it will recognize touches to childView even though it's outside of its superviews bounds: - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { if (!self.clipsToBounds && !self.hidden && self.alpha > 0) { for (UIView *subview in self