cocoa-touch

what code goes where for a iphone project

hi i was trying to complete an iphone projct from the iphone developers cookbook on draggable views clipped and i was having difficult working out which segments of code goes into what file iv been messing around awhile with it now any body can give me some direction heres the code /* *DragView: Draggable views /* @interface DragView ...

I'm creating a Polygon class in Objective-C, should centroid calculation be a function or a method?

I'm doing this to learn about class creation and to test geometry routines. As I build the class I will add other polygon-related functionality like getting the bounding box, determining convexity, turning the poly into triangles and the like. Is it best to put that kind of code in functions or in methods of the class? ...

How to check for local Wi-Fi (not just cellular connection) using iPhone SDK?

I'm currently using the following to check whether Wi-Fi is available for my application: #import <SystemConfiguration/SystemConfiguration.h> static inline BOOL addressReachable(const struct sockaddr_in *hostAddress); BOOL localWiFiAvailable() { struct sockaddr_in localWifiAddress; bzero(&localWifiAddress, sizeof(localWifiAddre...

Error with UIImageView

I have a compiler error and I just can't work out what is wrong. I am new to this so stuggling to decipher the error. In my .h I have... @interface LongViewController : UIViewController { IBOutlet UIImageView *loadImageInto; IBOutlet UIImageView *loadedInto; } -(void)fadeIt:(UIImageView*)imgNamed; And in my .m... -(voi...

modalViewController error. the strangest that I have ever encountered.

Hi, I'm amused by a strange error that I'm encountering in my program. I have a tableViewController with a navigationBar. When the user clicks on an ADD button on the navigationBar, they're presented with a modal tableViewController. This viewController has a CANCEL button on its navigationBar (which dismisses the viewController via de...

implementation methods to interface xcode script

Hello, I would like to ask if somebody has some user script to copy all implementation methods definitions to the clipboard that can be pasted to the header definitions. ...

Math logic (basic trig) in a game, what is this code doing?

I'm trying to better understand what exactly this code is doing. It's written in Objective-C, but should be familiar to anyone with a C background. What exactly are sin/cos mathematics doing here? Also, does anyone have a good recommendation for learning trig for gaming concepts such as these? for (int i = 0; i < GAME_CIRCLES; i++) { p...

Transparent color works on the simulator but becomes black on the iPhone

Hi! I am trying to draw an image that has some transparent regions. I load the image using image = [UIImage imageNamed:@"testimage.png"]; and draw it using [image drawAtPoint:CGPointMake(0,0)]; The UIView on which I draw the image is not opaque (and it has a transparent background color). The problem is that everything works fin...

Why is Instruments reporting custom UITableViewCell code as a memory leak?

I'm still trying to find my way through memory management for the iPhone SDK, and I'm not sure why Instruments is reporting a certain block of code as a memory leak. I've followed tutorials for these parts of the code, so I'm not really sure what I'm doing wrong. The violating block of code: DreamTableCell *cell = (DreamTableCell *)[ta...

How to hide/show controls in UITableViewCell when it goes in/out of editing mode?

I have few custom controls (image views) added programmatically to table cell. I want to hide them when table view goes into editing mode and show them again when view gets out of editing mode. I'm not using UITableViewCell subclasses, controls are added through tableView:cellForRowAtIndexPath: method. When and where should I do the hid...

UITableView crashes after trying to delete a cell the *second* time

Hi guys - another weird problem with the iPhone SDK here. I have a UITableView which contains a custom UITableViewCell. This table gets its data from a mutable array, which in turn pulls it from a Core Data storage. The problem: If I enter editing mode and delete a cell, it works for the first time - the cell is successfully removed fr...

Duplicate records in Core Data on fetch

Folks, I've got a bit of a puzzler involving Core Data in my iPhone project. During the viewDidLoad method in two separate view controller instances I call the following method: - (NSFetchedResultsController *)getStudentResults:(NSString *)classRoom forWeekStarting:(NSDate *)startDate andEnding:(NSDate *)endDate { AttendanceAppDel...

Automatically expand UITableView - NSRangeException

I have a SQLite database tied to my uitableview. There are about 2000 rows, so I retrieve 25 rows at first. Once I scroll to the end of the list, I want it to automatically retrieve 25 more rows. Here's the method I'm using now. Ignore what would happen if I load all 2000 rows, I'll worry about that later. In tableView:numberOfRowsInSe...

How do I resize and save an image on the iPhone?

Hi, I want to save the image that is pinched to different size from original size. How could I save it? How should I write the code ? ...

How to remove the "white reflection" on the application icon?

Hi this is an iPhone objective C question. When I set the icon file for the app, say, icon.png. When it is shown on the phone, a white reflection effect is automatically added on the icon.png Is there any way to remove te reflection effect? Cause I can see that there are apps without the white reflection effect on the icons ...

How to add extra cells in a UITableView in editing mode?

Do you know how to have some cells appear in a table view after the table goes into editing mode? Just like the "Contacts" iPhone app does when you edit a contact. Maybe I'm wrong, but when editing the contacts, it looks like a grouped UITableView is used. I tried this: [self.tableView setEditing:YES animated:YES]; [self.tableView ins...

Programmatically pasting into an iPhone UITextView

I have an iPhone app with a UITextView. I'd like to be able to paste the clipboard contents into it without showing the UIMenuController. I tried calling the paste: method on the UITextView, and on the first responder, but neither of those things worked. I was able to implement this by writing a bunch of code to read text from the clip...

Modifying an iPhone animation container view before starting animation

I am adding some basic animation to a card game I'm working on. (My first iPhone app.) I am creating a custom UIView class "AnimationContainer", which flips from image1 to image2, while moving from rect1 to rect2. My ultimate intention is to have up to four of these containers doing their transitions simultaneously. The problem I'm hav...

Iphone: Unable to load modal view from UITabBarController

I want to be able to present a modal view with an instance of a UIViewController. I have no problem doing this when presenting it from a standard UIViewController (the root view). I have set up a delegate to make the presenting root view close the modal view. This is according to Apple best practice. When I try to make the same root vie...

how to create info button on uinavigationbar on iphone

I've seen many of applications that have an info button (the letter "i" with a circle around it) on the uinavigationbar. How do I add this type of button? ...