Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
nullfox
Aug 19, 2008
I am in the process of writing a new iPhone app that will be heavily dependent on the API and will have a large number of API calls coming in and out.

How do you guys usually structure your API client libs in an iPhone app? I thought about having a base API request object and sub-classing them for each API method, but depending on the controller that would be implementing them, that would be alot of seperate delegates to tie in to each class.

Another one I saw was supplying a selector which I've seen ASIHTTPRequest use as well as ShareKit. They let you supply a "finished" selector and looks for that in the class defined as the delegate.

[delegate performSelector:finishedSelector withObject:data];

Any tips/suggestions, etc?

nullfox fucked around with this message at 20:33 on Apr 18, 2011

Adbot
ADBOT LOVES YOU

nullfox
Aug 19, 2008
I'm having an odd issue with UISegmentedControl...

My structure looks something like this...

- Controller's UIView
-- UIImageView (This is a background bar for the segmented control)
--- UISegmentedControl (Control with 3 items, added as a subview of the ImageVIew)
-- UITableView
-- UITableView
-- UITableView

The idea is that the table views hide/show depending on which SegmentedControl button is selected. This works... mostly... There is a weird issue I'm running into.

If I tap any of the segment buttons, then attempt to drag the table (which is well below the segmented control), it "pops" the selected segmented control back to the first one, un-hiding the first table in the process. It only seems to occur on a tap+drag motion and tapping on a table row selects it just fine.

I tried telling the segmented control to resignFirstResponder when the method bound to the UIControlEventValueChanged fires but to no avail.

Anyone run into this?

nullfox
Aug 19, 2008

pokeyman posted:

Without seeing any code (would be handy to reduce this to a simple test case), maybe the segmented control is still getting touchesMoved events after you think you've chosen a segment. When you then drag on the table, the segmented control finally gets a touchesEnded event, and since the end touch isn't on a segment, it cancels the whole thing. Is that possible?

I would imagine it certainly is possible, I don't know how/why touchesEnded wouldn't be triggered, but I'll mess around with it.

false image posted:

This doesn't answer your specific issue, but from my personal experience I would recommend that you never have multiple table views in the same view, simply reload the table data using the new data source that you want to use.

I wasn't sure what best practices dictated in cases like that, but I will definitely switch it up.

nullfox
Aug 19, 2008
I'm a loving derp...

[modeControl setSelectedSegmentIndex:0]; in layoutSubviews...

nullfox
Aug 19, 2008
I have another odd issue...

I created a category for a particular class and even though I've yet to actually import the category into ANY class, the prefix header or anywhere I can find via searching in XCode and grepping the filesystem - the category is still being loaded and doing it's voodoo.

What the hell?

nullfox
Aug 19, 2008

pokeyman posted:

If the .m file gets compiled and linked (i.e. has a target in Xcode), the class gains the methods. The .h file simply tells the compiler about the methods defined therein. If you want to keep the category methods out, remove the .m from the target.

Clearly my sound understanding of ObjectiveC comes into question... That makes sense

Another quick one - Is there an accepted strategy for requesting/displaying remote retina images?

Adbot
ADBOT LOVES YOU

nullfox
Aug 19, 2008
I'm having an issue saving and fetching an image to and from CoreData. My CoreData entity has a couple string properties and a binary data property called imageData.

I have added a getter/setter to my model subclass for image/setImage with the following code:

code:
- (void)setImage:(UIImage *)image
{
    NSData *data = UIImagePNGRepresentation(image);
    [self setImageData:data];
}

- (UIImage *)image
{
    return [UIImage imageWithData:[self imageData]];
}
The issue is, when I add and save a new instance of this entity, with the image set, my table view, which implements a fetchedResultsController then adds the new row and the image doesn't show. If I log it, it shows null - the odd thing is, if I tap the row to go to a detail screen, the image shows up there.

Is there a noticeable delay between telling CoreData to save, the actual save and the time that a fetchedResultsController gets told to update? If so, is there a way I can account for it?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply