objective-c

How can I consolidate deferred/delayed calls in Objective-C ?

I'd like to ensure that certain maintenance tasks are executed "eventually". For example, after I detect that some resources might no longer be used in a cache, I might call: [self performSelector:@selector(cleanupCache) withObject:nil afterDelay:0.5]; However, there might be numerous places where I detect this, and I don't want to be...

Core Data confusion: fetch without tableview.

I have completed and reproduced Core Data tutorials using a tableview to display contents. However, I want to access an Entity through a fetch on a view without a tableview. I used the following fetch code, but the count returned is always 0. The data exists when the database is opened using SQLite tools. NSManagedObject *entryObj;...

Has anyone tried integrating custom fonts in UIButton?

Trying to put in FontLabel (http://github.com/zynga/FontLabel) into a UIButton. At first I wanted to set titlelabel. But it's restricting a setter to it so i can't just set the label to it. Just wondering if anyone has an idea in doing this without using images to set my custom button. ...

populate UITableView from json

Hello all working on my building my first iDevice app and I am trying to populate a UITableView with data from json result I can get it to load from plist array no propblem and I can even see my json the problem I'm having is that the UITableView never gets to see the json results please bare with me as this is first time with obj-c or a...

Multi-line strings in objective-c localized strings file

I have a template for an email that I've put in a localized strings file, and I'm loading the string with the NSLocalizedString macro. I'd rather not make each line its own string with a unique key. In Objective-C, I can create a human-readable multiline string like so: NSString *email = @"Hello %@,\n" "\n" "Check out %@.\n" ...

How to display a set image while UIWebView is loading?

I have an iPhone application with TabBar and WebView. I would like to have a view with an image that pops up over the webview every time I send a new page to load and disappears when the page is loaded. How can I accomplish that? ...

does code in finally get run after a return in objective-c?

consider the following code: @try { if (something.notvalid) { return; } // do something else } @catch (NSException *ex) { // handle exception } @finally { NSLog(@"finally!"); } if something is not valid and i return from within the try, does the code in @finally execute or not? I believe that it should but others I've...

Override default behavior of a movie going fullscreen in Obj-C

I have a movie player and am observing MPMoviePlayerWillEnterFullscreenNotification. I need to be able to cancel the default behavior (like event.preventDefault() in AS3) and resize the movie myself. Possible? ...

moving CGPoint a certain distance along a certain heading...iphone

this seems like such a simple problem but I have been unable to find an answer (and im no good at math). I am trying to move a UIView to a new CGPoint X distance away along a certain heading. What is the formula for determining the new coordinates? (i do no want this to be animated, just an instantaneous move) something like: x = 100;...

Getting unique items from NSMutableArray

Hi Guys, I have a question about Objective-C today involving NSMutableArray. Coming from a .net/c# background I'm having some trouble working with these things. Let's say I have an object called "Song" My song has 3 properties: Title Artist Genre I have a NSMutableArray or NSArray wich holds all my Song objects. How would I go ab...

adding transitions to subview from my UIView

Hi, I would like to know if there is anyway to add a transition effect to my Subview of my UIView. basically I have created methods and buttons in my view controller that I would like to effect my subview. Here is a short video clip explaining it better: http://screencast.com/t/OTY4NmZkZG Paste this link in your browser please. pleas...

How can I programmatically get the Bluetooth MAC address of an iPhone ?

I'm trying to do some proximity detection of iPhones but I need to get their Bluetooth MAC address programmatically. Does anyone knows how ? I assume Bluetooth is activated but no device is paired with the iPhone. ...

NSDateFormatter - set device language as locale?

Hey. I'm trying to get the iPhone to display dates formatted by an NSDateFormatter in the current device language. I have tried setLocale:[NSLocale currentLocale], but that only returns 5 instead of May (or Mai, as I want it to be). EDIT: currentLocale shows May (english). systemLocale shows 5 (I think systemLocale is Norwegian), and ...

Intercept UITableView scroll touches

Is it possible to control when the UITableView scrolls in my own code. I am trying to get behaviour where a vertical swipe scrolls and a horizontal swipe gets passed through to my code (of which there are many example) BUT I want a DIAGONAL swipe to do nothing, i.e the UITableView should not even begin scrolling. I tried catching it ...

How do I go about including the Tortuga 22 NinePatch library to my XCode project?

Hello CocoaTouch experts! First of all, there is finally NinePatch support for the iPhone, BIG thanks to the Tortuga 22 team for that. Unfortunately for me I have not been able to add their library to my project. What is NinePatch? The Tortuga 22 blog post. The source code at git hub. If I just drag and drop the source-files into my...

Cocos2D - NSMutableArray of CCSprites.

I tried storing some CCSprites in a NSMutableArray, but the game crashed immediately, I'm guessing it's a memory problem, and I'm also guessing that CCSprites are autorelease objects? So, how would I store multiple CCSprites in a NSMutableArray? The purpose I wanna do this is store for example all enemies in an array, and then loop thr...

xcode 3.2.2 and objective-c 2.0 and debug: where are my object's property/instance variable values in debug?

working on a mac os project (meaning not iPhone) requiring 10.6 and is 64bit, allows me to use properties to generate both accessor methods and instance variables in the header file. but, during debug, i'm not seeing how to look at the object's properties values after they have been populated. is there some build setting that needs to be...

adding transitions to subview from my UIView with button

Hi, I would like to know if there is anyway to add a transition effect to my Subview of my UIView. basically I have created methods and buttons in my view controller that I would like to effect my subview. Here is a short clip explaining it better: my screen cast: http://screencast.com/t/OTY4NmZkZG ...

Fade to black within a uinavigationcontroller?

I want to fade the whole screen (including navigation bar) to black when a user presses a button on a uinavigationcontroler, before showing a new view. (i don't want to push this new view, for various reasons). How would I achieve this? EDIT Thanks to Mac and Eiko, I have figured it out. Here's the code I used. Not sure if it is opti...

creating IBOutlets for a the SubView connecting to my UIView.. iPad sdk 3.2

I have created a class that gives me a header.h a main.m and an XIB.xib file. I went through the process of creating a subview thanks to some tutorials online. the issue im having is, I want to create a IBOutlets that can be connected to my "Subview" NOT my UIView. I know it sounds weird, but the buttons will appear in my UIView, but the...