objective-c

Sharing Data between XIB's

Hey everbody. I'm following the James Brannan tutorial's, and im trying to share data between some xbis. No luck. I have 2 xib's. The first, simple button and textfield. The second, just a label, to show the result of the first xib textfield. So, i dont know what im doing wrong. Im using NSObject like in tutorial. SharedData.h #impo...

Create an NSMutableArray using NSCalendar

Hi, I have following problem: I need to create an NSMutabeArray with every weekday after a specific date. This should look like: Thursday 28 october 2010 Thursday 04 october 2010 Thursday 11 october 2010 ... How can I do that? I think it has something to do with NSCalendar, but I can't find the right solution... Could you help me? ...

UITabBarController + UINavBarController

I know that this has been discussed several times in many other topics, blogs, book, youtube, etc. But, let me explain my case. I want so that when an application opens up, it shows a facebook connect button to login. After the user login, then it will bring up the tabBarView. In my app delegate I first add the MainViewController and the...

objective C touch events problem

I have a 4 UIViews inside a UIScrollView. Assume 1 of it is a chart like in iphone stocks aplication. When I move the finger across the chart I need to draw a vertical line.I can use the touchesMoved for that. But Also I need to move horizontally scroll my views. Problem is when I move my finger across the chart, UIScrollView scrolls ho...

Objective-C Core Data: Access data from child of child

I'm slowly figuring out Core Data for my iPad app, but I just can't seem to figure out how to access data from my to-many children (who also have to-many children). I'm hoping to get some code examples from the experts here. Let's use a simple data structure: Parent -(to many)-> Child -(to many)-> Toy I can fetch the Parent just fine ...

Save state of my app

Helllo all, in my app there is a story 1 hour i want to know if the user exit the app in the half (time) of the story or any time then when he return i want to continue from where he left any idea will be great thanks ...

How to get table target cell inside tableView:heightForRowAtIndexPath:?

Hey community, I am trying to get variable-height table cells implemented and what I thought would be an elegant solution turned out into a recursion/stack overflow: - (CGFloat)tableView:(UITableView *)aTableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { MyCustomCell *cell = (MyCustomCell *)[aTableView cellForRowAtIndexPa...

NSURL fileURLWithPath where NSString has a space

Hello, I've looked at quite a few of the related questions and cannot find a similar problem or a solution so my apologies if there is a duplicate out there somewhere. Anyway, I'm trying to generate a file's NSURL to use with an NSXMLDocument. I have the following components: const NSString * PROJECT_DIR = @"~/SP\\ BB/"; const NSStrin...

initializer, properties, accessors and copy/retain/readonly

I want to understand how to set the parameters of properties (accessors). I took the following code from an example of Kal calendar. // Holiday.h @interface Holiday : NSObject { NSDate *date; NSString *name; NSString *country; } @property (nonatomic, retain, readonly) NSDate *date; @property (nonatomic, retain, readonly) NSStri...

Mapkit used in a grouped table cell and extends the rounded corners

I have a custom UITableViewCell set up with a MKMapView set up within the cell. I would like the map to take up all of the cell and so I have set the Map View to have the same dimensions as the TableCell. The application is working ok, but the square corners on the Map View extend beyond the bounds of the table cell. Is there a way to...

iPhone Reading Property From Other Class In UITab

I'm new to Objective-C and have a little bit of problem. I made an app that has a button that switches to tab number 2 in the app but I want it to get specific data from the database so I've written code in which I pass from the first view a number which is the id of the row I need to the second view @synthesize goTo; -(IBAction)go...

apple has rejected my iPhone app saying it must run on iPad as well

Hey, I've just submitted my app to review (for the App-Store), and apple has rejected my app, saying the following: "On iPad, the application displays a black screen and no content loads. This review was conducted on iPad running iOS 3.2.2 as well as iPhone 4 running iOS 4.1. A screenshot has been attached for your referen...

Obj-C Global Strings & Variables

There's some way to declare Strings and Variables in Obj-C for iPhone? I mean, i want to display the data input on textfield in 01.xib on 02.xib label's. How can i do that? Thanks! ...

Get image paths from NSBundle in Objective C?

I have about 60 images I want to store in Core Data, 30 of which are avatars and have the prefix of avt_filename_00X.png and 30 of them are smaller and have a different prefix. Rather than storing all the images as BLOBs in Core Data/SQLite, I want to store the paths for each image found (in the same way you would store image paths for ...

Using self on iVars in dealloc?

Usually I write my dealloc to look like this: - (void)dealloc { [coffeeList release]; [super dealloc]; } But today I typed (see below) and was a little puzzled why I got an error running the code through the CLANG static analyser. As I say I don't usually add self to iVars in dealloc, but was just a little curious when I spott...

Releasing memory allocated in class method initialize

I am allocating memory in the class method initialize: UIColor * customBlue; UIColor * customRed; @implementation UIColorConstants + (void)initialize{ if ( self == [UIColorConstants class] ) { customBlue = [[UIColor alloc]initWithRed:0 green:0.137 blue:0.584 alpha:1]; customRed = [[UIColor alloc]initWithRed:.91 green:0.067 blue:...

saving images in lower quality(256, 16, 4, 2 colors) - cocoa

Hi. I am trying to work with images in Cocoa - open images and manipulate with them. I take ImageApp as example . All work fine, but I need to save images in lower quality -(8, 4, 2, 1 bits per pixel - 256, 16, 4, 2 colors respectively). According to documentation, the "lowest" pixel format is Gray 8 bpp, 8 bpc,kCGImageAlphaNone and i...

@dynamic properties and its usage?

Can anyone give me clear picture about dynamic property and its usage? y not use the usual @property everywhere? ...

[ObjC] Custom UIImageVIew with touchesEnded works only with the first view

Hi! Sorry for bad title :( I've a controller that has a scrollview where I display some other views, in this case an IngredientImage, that is a subclass of uiimageview: #import "IngredientImage.h" @implementation IngredientImage - (id) initWithImage:(UIImage *)image { if (self = [super initWithImage:image]) { } [self...

Convert 24h to 12h time format in Obj-C

I currently display time in 24h format, because it's the easiest thing for me to do right now with the data I have. I get the time in "minutes since midnight", so for example, 07:00 or 7:00 a.m is "420" and 21:30 or 9:30 p.m is "1290" and so on. [NSString stringWithFormat:@"%02d:%02d - %02d:%02d", (open / 60), (open % 60), (close / 60)...