objective-c

how to display indicator

I cannot display Indicator View. ItemController.h #import <UIKit/UIKit.h> @interface ItemController : UITableViewController { UIView* loadingView; UIActivityIndicatorView* indicator; } @property (nonatomic, retain) UIView *loadingView; @property (nonatomic, retain) UIActivityIndicatorView *indicator; @end ItemController.m .....

How to push WebView in NavigationController

I want to display web view when table cell is selected - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [uiWebView loadRequest:[NSURL URLWithString:@"http://www.google.com"]]; [self.navigationController pushNavigationItem:uiWebView animated:YES]; } log -[UINavigationController pushNav...

iPhone NSTimeZone: localTimeZone confusion

From what I understand, calling NSLog(@"Local Time Zone %@",[[NSTimeZone localTimeZone] name]); gives you the local time zone of the device. What it's giving me is "US/Central", and I can't find that anywhere in the list of abbreviations in [NSTimeZone abbreviationDictionary], or the list of time zone names in [NSTimeZone knownT...

Regex to get value within tag

I have a sample set of XML returned back: <rsp stat="ok"> <site> <id>1234</id> <name>testAddress</name> <hostname>anotherName</hostname> ... </site> <site> <id>56789</id> <name>ba</name> <hostname>alphatest</hostname> ... </site> </rsp> I want to extract everything within <name></name> but not ...

how to use sortUsingFunction:context

appdata.items is NSMutableArray. I connot compile This code. Error code is "prop.173 has an incomplete type". NSInteger compareInfo(id aInfo1, id aInfo2, void *context){ NSDate* info1 = [aInfo1 objectAtIndex:2]; NSDate* info2 = [aInfo2 objectAtIndex:2]; return [info1 compare:info2]; } -(void)saveData{ NSData* data = [[NSMutab...

Objective C - UILabel multiline vertical gap height

Hi, I have a multiline UILabel that can take a maximum of 3 lines. i.e message.numberOfLines = 3; Everything works fine, but how can I set the vertical gap between the lines? e.g between line 1 and line 2 etc? Please enlight, Tee ...

Transparent layer-backed views

I'm trying to perform some simple animations using CA layers on transparent window and corresponding view. The problem I have is that every time I turn on the layer backing (either through wantsLayer in code, or with IB) the view stops being transparent. I've tried setting layer's backgroundColor to something with low alpha and I took f...

Fetched Properties v Relationships (Core Data - iPhone)

I'm a new iPhone developer (of about 4 months or so) who is starting to look at Core Data. In the "Beginning iPhone 3 Development" book by Dave Mark it mentions that the main difference between fetched properties and relationships is that fetched properties allow lazy loading. However, I have seen other resources and accepted answers o...

3 notifications instead of one

I'm developing simple MVC app in Cocoa/Objective-C. I have a strange issue (or misunderstanding) with notifications and KVO. I have AppController object in MainMenu.xib, hence I implement awakeFromNib method where I register for NSImageView changing its image property. I add self as an observer in the following way: // options:3 equals...

Regular Expressions in Objective-C and Core Data

Hi all, Is there a guide to using regular expressions in objective c? Specifically what to type into the "Reg. Ex." field in a core data property? In particular, how to limit input to a set amount of numbers/letters only, and for UK Post Codes? Thanks! ...

Change title of MFMailComposeViewController

I'm using MFMailComposeViewController for in-app email in my app, but I'm not able to change the title. As default it's showing the subject in the title, but I would like to set the title to be something else. How can I do that? I've tried: controller.title = @"Feedback"; but it didn't work. Here's my code: - (IBAction)email { NSA...

iPhone custom drawn UITableViewCell , how to load + insert images from the web in a thread?

Hi. I've been drawing custom table cells (using the samples from apple as a base) and have now come to having to do a cell which displays an image from a URL - each cell would have a different image (based on some data it has) but all the cells are the same and so the same reuse id. What's the correct structure for doing this? Obviously...

NSImage leaking?

So I'm trying to duplicate the SourceView example in my app. I can generate the source list perfectly, fine. I can also expand the containers, and everything is displayed fine. However, when I select an item in the list, the app crashes with an EXC_BAD_ACCESS. Backtrace #0 0x7fff86532340 in objc_msgSend_vtable14 #1 0x7fff8508f622 in ...

Should I send retain or autorelease before returning objects?

I thought I was doing the right thing here but I get several warnings from the Build and Analyze so now I'm not so sure. My assumption is (a) that an object I get from a function (dateFromComponents: in this case) is already set for autorelease and (b) that what I return from a function should be set for autorelease. Therefore I don't ...

how do I get class info at runtime in objective c

I am pretty new to objective C, I was trying this: I have NSMutableArray with different objects in it of different classes. Now I want to get the class name & related stuff & also check if the respective object is NSString or not. How should I go about it.. I was trying something like this it wasn't working ofcourse for(NSString *str...

Wrapping a UITableViewController in NSProxy

I have a subclass of NSProxy designed to forward messages to either an object instance or to Lua functions if they are defined for the selector. This works in most cases. UITableViewController, however, is a different case altogether. When I set up my proxy object with an instance of UITableViewController (or a stub subclass) it doesn't ...

Licensing system for static library

I'd like to sell a static library for Cocoa Touch apps but want to protect it from being freely distributed. Has anyone tried this or have suggestions on a scheme(s) that I can build to handle it? One example from the desktop world is a vendor sending a license key to you after purchasing the library. That key must be embedded in your...

Convert Seconds Integer To HH:MM, iPhone

Hi there, I am struggling with this. I have a value in seconds that I want to display in a label in HH:MM format. I have searched the internet for ages and found some answers, but either not fully understood them, or they seem like an odd way of doing what I want. If someone could help me out on this one that would be great! Bear in min...

Loop Until Condition Reached, iPhone

Hi there, I have a problem here... After a button is pressed I want a loop to run until a condition is reached: - (IBAction)buttonclick1 ... if ((value2ForIf - valueForIf) >= 3) { ... I would like a loop to run until ((value2ForIf - valueForIf) >= 3) and then execute the code associated with the IF statement. What I am aiming t...

about get value from sqlite

Code Sample: NSString *str= [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectStatement, 1)]; Test *t=[[Test alloc] init]; t.str=[str copy]; // why use "copy" here? [str release]; ...