cocoa-touch

Cocoa-Touch: memory management

I'm customizing a UIPickerView's rows, so I'm implementing the viewForRow method in it's delegate as follows: - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view { if (view) { return view; } else { NSString *s = [datePickerValues...

NSMutableDictionary lookup based on object's address or value when dealing with NSNumber?

If you store NSNumber* as a key to NSMutableDictionary, does it do the lookup later based on the key's address or stored value? It seems that if I store NSNumber in two dictionaries with the value from one serving as the key to the other, sometimes, the key isn't found in the 2nd dictionary even though I'm certain it's in there. What I'...

NSTimer Troubles

I am trying to run the code below but it keeps locking up my simulator after the "Tick" is written to the console. It never outputs "Tock" so my guess is that it has to do with the line "NSTimeInterval elapsedTime = [startTime timeIntervalSinceNow];" The IBactions are activated by buttons. timer and startTime are defined in the .h as NST...

matrix of buttons

Hello I have a matrix of buttons, 4x3 And i have the following problems, or let's say i don't know where to begin they are inited with a label from an array and they call the same function -(IBAction)buttonPressed:(id)sender Buttons are made programatically, not sure the function needs IBAction. How do i detect in this function what bu...

Cocoa-Touch: UIPickerView viewForRow is changing row orders

I have a UIPickerView. I'm customizing it's rows via it's delegate's viewForRow as follows: - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view { if (view) { return view; } else { NSString *s = [datePickerValues objectAtIndex:row...

Top margin on UITableViewController

I have a TabBarController, one of the tabs of which contains a sub view which is a navigationController. I am then loading into the navigation controller a view which inherits form UITableViewController. My problem is thta for some reason the table view starts behing the navigation controller, not the top of the screen but about half wa...

Background of UILabel visible after a composite.

I am doing something a bit unusual. I'm trying to tint all the components in my application red (you may have seen some other postings from me about this, but this is something more specific). To do so, I'm intercepting all calls to CALayer's drawInContext: and after calling the original method, I composite red onto the layer using kCG...

iPhone Reachability

I am trying to cover my bases with reachability so that my app doesn't get rejected by the App Store. I am familiar with the Reachability class that Apple provides in sample code. My question is, how best to implement this. I've seen that checking if the WWAN is accessible is not always best because it may be turned off for power cons...

motionEnded getting called multiple times

I have a UIViewController subclass that I am trying to have handle the shake event when its view is up. Here are the relevant methods I've implemented: - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [self becomeFirstResponder]; } - (void)viewDidDisappear:(BOOL)animated { [self resignFirstResponder...

Strange issue with Indexed UITableView's section index title is incorrect

I ran into a strange issue with my indexed tableview's section index titles. The index titles returned is correct (A - Z) as outputted by the debugging code below but the displayed index titles on the right side of the table is separated with • instead. So instead of A B C D... I get A • C • E •... instead. Any idea what's causing thi...

Copy a file from iPhone sandbox to Desktop?

Hi all, I am developing an iPhone app for uni and we create an sqlite database file within the iPhone's sandbox directory. Our application writes internally to this file, I am wondering how it would be possible to get this file back to my desktop. I don't really mind how it can be done, any way is fine. Maybe it is possible to even do ...

NSData Behaving as a Consumable Data Stream. Possible?

I am currently doing a lot of data wrangling. I ingest a lloonngg NSData byte streams and then parse that data. The parsing is trivial. However, I have to simulate consumption of the data as I parse via not particularly elegant bookkeeping. Here is what a typical method looks like in the category of NData I have implemented: // Grab a l...

Better strategy for waiting for a modal window to finish?

I've got a custom ModalDialog class, which I've got working well in most situations. It returns its results via a delegate method, which then continues the app appropriately based on the user's button selection. However, there are some places in my app where the dialog really needs to pop up in the middle of a method (for example, my ga...

iPhone: Using static library in an application crashes the device but not the iphone simulator

I have a library I made, and now I want to utilize it in an application. I've believe I've properly linked to the library. Here are all the things I've done: Set the header search path Set other linker flags to "-ObjC" Added the static library xcode project Made sure the lib.a was listed as a framework target Added the library as a dir...

Cocoa-Touch: dynamically resizing views

I have a UITableView which occupies the entire screen, besides a navigation bar. The UINavigationItem has a UIBarButtonItem that shows a previously hidden UIPickerView when tapped. I'm trying to resize the UITableView so that it occupies the rest of the screen not used by the now visible UIPickerView. I know the framework already does ...

Forcing UITextView to stay the same size while typing.

I have a UITextView that I shrink upon bringing up the keyboard. An issue I just ran into though is as I type past the keyboard, rather than the text start scrolling, the UITextView automatically gets bigger. How can I possibly turn this off? EDIT This is not a subclass, this is a plain old UITextView. It's definitely resized and gets ...

Objective-c way of serializing arrays that contain different types

Hello, My NSMutableArray instance contains instances of different types of objects that have common ancestor. I want to serialize the array, but NSKeyedArchiver class seems to archive arrays contain certain types of objects. Is there an easy way to to this with stock serialization classes ? ...

Cocoa-Touch, Core Data: Linker error, NSManagedObject symbol not found

I have a cocoa-touch app, using the core data framework. I've created a xcdatamodel with two entities: Program and ProgramReplay. ProgramReplay has a relationship to Program, and a reverse relationship exists in the later. I've saved this, and used XCode's feature to generate the classes for these two entities. The generated headers ar...

Streaming Audio FROM iPhone to Browser. Ideas?

I have seen plenty of articles and SO questions about streaming TO an iPhone app, but my question is the reverse, that is, streaming FROM an iPhone app. I have audio content in an iPhone app, that I want to stream to a browser. So the idea is that the browser can connect to a server running on the iphone. The server on the iphone will...

UIView subclass draws background despite completely empty drawRect: - why?

So, I have a custom UIView subclass which enables drawing of rounded edges. The thing draws perfectly, however the background always fills the whole bounds, despite clipping to a path first. The border also draws above the rectangular background, despite the fact that I draw the border in drawRect: before the background. So I removed the...