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
Yakattak
Dec 17, 2009

I am Grumpypuss
>:3

I find developer support extremely accommodating.

Adbot
ADBOT LOVES YOU

wellwhoopdedooo
Nov 23, 2007

Pound Trooper!

samiamwork posted:

The reason it doesn't work without the addSubview: is because you're inadvertently loading the nib when you pass self.moduleSelectorViewController.view as a parameter. Replace that line with [_moduleSelectorViewController view] and it works.

Ah, thanks. I'd assumed that .view ended up being called somewhere when I set it as a .rootViewController, I did think to verify that but I guess in my random flailing I did something else that appeared to confirm the assumption.

So, on to the next issues, I have a couple general Objective-C questions:

1: Is there a way to hide a method that a superclass implements in a subclass? I'm guessing there's not, but if that's the case, how do you handle subclasses requiring additional information before they're in a valid state? e.g. as in other languages where you have to manually implement every constructor in subclasses. Or is even requiring additional information not a good idea in Obj-C? Do subclasses not mean quite the same thing as in C++/C#/similar? How deep does this rabbit-hole go?

2: I see that I can sort of get pure virtual functions with protocols, but is there a way to make a superclass force its subclasses to implement a protocol? Or is there a better way to go about this? Am I thinking too C++ish again?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

wellwhoopdedooo posted:

1: Is there a way to hide a method that a superclass implements in a subclass? I'm guessing there's not, but if that's the case, how do you handle subclasses requiring additional information before they're in a valid state? e.g. as in other languages where you have to manually implement every constructor in subclasses. Or is even requiring additional information not a good idea in Obj-C? Do subclasses not mean quite the same thing as in C++/C#/similar? How deep does this rabbit-hole go?

I'm not entirely sure what "hiding a superclass's method" has to do with "subclasses requiring additional information". I'm kind of curious: can you give an example of a scenario that would motivate you to subclass but not support all of the superclass's methods?

Anyway, if you find a use for it, you can implement the methods you want to "hide" in your subclass by sending doesNotRecognizeSelector:.

As for overriding every constructor, Foundation (not Objective-C itself) has the concept of a "designated initializer". Other initializers eventually call the designated one, and subclasses then only need to call this designated initializer to get the superclass ready to go. (If your subclass changes the designated initializer, you should implement the superclass's designated initializer and have it call your subclass's new one.)

quote:

2: I see that I can sort of get pure virtual functions with protocols, but is there a way to make a superclass force its subclasses to implement a protocol? Or is there a better way to go about this? Am I thinking too C++ish again?

Have the superclass adopt the protocol, and all subclasses are similarly bound. If you want to test an arbitrary object's conformance with an arbitrary protocol, send it conformsToProtocol:.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Yakattak posted:

I find developer support extremely accommodating.

Cool, and thanks for the other responses too. I'll chill out for a bit.

LP0 ON FIRE
Jan 25, 2006

beep boop

samiamwork posted:

I'm not really sure what you mean by that, but that code won't work. If you assign a new value to the heroCollisPushPoints property you'll leak your original array and when you dealloc the object you'll crash when you over-release the second array you were given. If you don't want to allow other objects to give heroCollisPushPoints a new value then you probably want readonly.

Thanks for your insight. So if I'm making the right sense out of what you're saying, I should set that property to readonly instead of assign and get rid of the dealloc method since my other class will be deallocing the class object, which should dealloc that mutable array along with it.

LP0 ON FIRE fucked around with this message at 06:56 on May 1, 2011

wellwhoopdedooo
Nov 23, 2007

Pound Trooper!

pokeyman posted:

I'm not entirely sure what "hiding a superclass's method" has to do with "subclasses requiring additional information". I'm kind of curious: can you give an example of a scenario that would motivate you to subclass but not support all of the superclass's methods?

I probably phrased that badly, so please don't be offended if I'm explaining something you're already familiar with.

The only real instance of it that doesn't involve breaking promises is in constructors. As an example:

Pseudocode (C++ish):
code:
// This class does the obvious and writes stuff to a file.
class FileWriter {
  
  // Constructor requires a file.
  FileWriter (string const& filename);
  
};

// This class does the same thing, but logs it.
class LoggingFileWriter {
  
  // Constructor requires both a file and a log.
  LoggingFileWriter (string const& filename, Logger& logger);
  
};
The advantage of developing this way is, provided I'm careful about exception safety, I never have to write "invalid object state" errors for when you, say, try to call loggingFileWriterInstance.write("some text") without supplying a logger, because you can't even construct the object in an invalid state. By extension, you don't have to handle invalid state errors, because they don't exist.

Granted it's a lot more complex in the real world and sometimes impossible, and this example in particular would have a host of other errors to handle which minimizes the benefit, but the best error handling is preventing them in the first place, and it's something I strive for anyway.

I imagine the answer will be that in Obj-C, the usual way to do things is that if somebody instantiated LoggingFileWriter with the single argument constructor you'd delay the error until they called [instance write:@"something"] without setting .logger, but I really like trying to make things as close to impossible to use wrong as I can, so I'm asking even though I'm fairly sure I already know the answer.

And thanks for your other answers, I really appreciate all your help.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

wellwhoopdedooo posted:

I imagine the answer will be that in Obj-C, the usual way to do things is that if somebody instantiated LoggingFileWriter with the single argument constructor you'd delay the error until they called [instance write:@"something"] without setting .logger, but I really like trying to make things as close to impossible to use wrong as I can, so I'm asking even though I'm fairly sure I already know the answer.

I'm assuming that, in your example, LoggingFileWriter subclasses FileWriter, but you don't want anyone to be able to instantiate a LoggingFileWriter without passing in a logger, right? That clarifies what you meant. Thanks.

What would more likely happen without setting .logger is that .logger would be set to nil when the instance was initialized, so whatever message you wanted to send to the logger would evaporate into the ether and return nil. Presumably at this point the person using your code will wonder why the log file never gets written, and will figure it out.

I think you're approaching Objective-C with too much of a C++ mindset. Which is perfectly ok! Just be aware of it. C++ has much more of a "make errors impossible" kind of mindset, while Objective-C seems to go more towards "handle errors gracefully". (I think the dynamism of Objective-C makes many errors harder to find before they happen, and that's part of why there's more faith put on the person using the code.) There's a couple of ways that I deal with it: I turn on some warnings, and I assume more competence on the part of the user of my code.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Is there a quick blog post or guide to setting up your own buttons for a simple game? I just want 'right', 'left', 'rotate', and 'drop'.

I'm under the assumption that I can't (or shouldn't) use UIKit because I made my own view and I'm just drawing crap to that with Quartz2D, mostly just using my awesome sprite function hooked up to a timer:

code:
-(void) drawSprite:(int) spriteImage x:(int) x y:(int) y {
	CGContextRef context = UIGraphicsGetCurrentContext();
	CGContextSaveGState(context);
	
	[bug[spriteImage] drawInRect:CGRectMake(x, y, BZ_SPRITE_WIDTH, BZ_SPRITE_HEIGHT)];
	
	CGContextRestoreGState(context);
}
I was thinking I would just make 4 images (well maybe 8, one to use while the button is 'down') for each button and draw them every frame. Then just handle the touch events for my view, figure out which button is touched and do whatever from there. Would it be best to write some sort of function that returns a button ID instead of putting the same screen location detection in each function?

modig
Aug 20, 2002

Bob Morales posted:

Is there a quick blog post or guide to setting up your own buttons for a simple game? I just want 'right', 'left', 'rotate', and 'drop'.

I'm under the assumption that I can't (or shouldn't) use UIKit because I made my own view and I'm just drawing crap to that with Quartz2D, mostly just using my awesome sprite function hooked up to a timer:

code:
-(void) drawSprite:(int) spriteImage x:(int) x y:(int) y {
	CGContextRef context = UIGraphicsGetCurrentContext();
	CGContextSaveGState(context);
	
	[bug[spriteImage] drawInRect:CGRectMake(x, y, BZ_SPRITE_WIDTH, BZ_SPRITE_HEIGHT)];
	
	CGContextRestoreGState(context);
}
I was thinking I would just make 4 images (well maybe 8, one to use while the button is 'down') for each button and draw them every frame. Then just handle the touch events for my view, figure out which button is touched and do whatever from there. Would it be best to write some sort of function that returns a button ID instead of putting the same screen location detection in each function?

This is probably useless to you, but why are you using that rather than just using CoreAnimation and UIImageView?

kitten smoothie
Dec 29, 2001

Nybble posted:

I'm in the process of creating a company. My incorporation is almost complete, but there are a few more steps left. In the meantime while the lawyers are taking care of that, I would like to start doing some programming. Since eventually I will be signing up through the Apple Dev program as a company, and not an individual, should I just buy XCode now, and sign up later for the program? It seems like from Modig's experience, it can take some time anyway. (Also, I'm impatient)

Edit: My impatience took over. What's 5 bucks? Chump change, that's what. If anyone has any experience with signing up a company with the Developer program I'd love to hear about it. Ease of signing up, what all they required (like EID or other papers), etc. Thanks!

This is a reply that's a week late, but I signed up as an individual so I could test on my device and then had my account converted to a company account when I was ready to sell stuff. Took only about a week to change it over and I just had to fax over a copy of the incorporation certificate I got from the state to document the company.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

wellwhoopdedooo posted:

The advantage of developing this way is, provided I'm careful about exception safety, I never have to write "invalid object state" errors for when you, say, try to call loggingFileWriterInstance.write("some text") without supplying a logger, because you can't even construct the object in an invalid state. By extension, you don't have to handle invalid state errors, because they don't exist.

Granted it's a lot more complex in the real world and sometimes impossible, and this example in particular would have a host of other errors to handle which minimizes the benefit, but the best error handling is preventing them in the first place, and it's something I strive for anyway.

I imagine the answer will be that in Obj-C, the usual way to do things is that if somebody instantiated LoggingFileWriter with the single argument constructor you'd delay the error until they called [instance write:@"something"] without setting .logger, but I really like trying to make things as close to impossible to use wrong as I can, so I'm asking even though I'm fairly sure I already know the answer.

And thanks for your other answers, I really appreciate all your help.


First rule of Objective-C: It has much more in common with Javascript than C++.

In Javascript, I can mess with Object's prototype and do all kinds of insane things. I can mess with the browser's built-in objects/DOM objects, etc. Objective-C is basically the same in that regard; you are free to do a huge range of things and a lot of what is required in other languages is merely by convention in Objective-C.

For example, @private/@public are just suggestions. You can ignore them and access private ivars if you like. You can also send messages corresponding to private methods if you know their signature. You can use categories to supplement system objects or even replace Apple's implementation. You don't even have to ever call init if you don't want to. You can also construct wildly odd and dangerous inheritance hierarchies, shove proxies in there to move stuff around, use KVO and dynamic invocation, and a bunch of other stuff that makes a regular C++/C#/Java person freak out. You can even get fancy and start returning yourself autoreleased or returning non-autoreleased objects from regular methods, or start swizzling so your program is impossible to debug.

But much like Javascript you realize that in the real world it tends to work out just fine most of the time. You also realize that a lot of the OO stuff provided by other languages (friend/internal/protected/etc) aren't really necessary unless you are writing a large complex library... in which case you do things like provide NSString as your public API but actually spit out NSCFStrings at runtime, thus hiding your implementation details.


However I'd still vote for garbage collection on iOS if I could; manual memory management is for chumps.



Bonus unrelated protip: If you are adding stuff to a class via a Category and need a slot to stash property values (since you can't add ivars), meet these two lovely functions:
code:
#import <objc/runtime.h>
...

   id value = objc_getAssociatedObject(self, "currentValues");


    objc_setAssociatedObject(self, "currentValues", nv, OBJC_ASSOCIATION_RETAIN_NONATOMIC);

...
Shazam! Enjoy.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

modig posted:

This is probably useless to you, but why are you using that rather than just using CoreAnimation and UIImageView?

I don't really know.

samiamwork
Dec 23, 2006

NOG posted:

Thanks for your insight. So if I'm making the right sense out of what you're saying, I should set that property to readonly instead of assign and get rid of the dealloc method since my other class will be deallocing the class object, which should dealloc that mutable array along with it.

It depends on what you're trying to do, but if both objects need it then both should retain it (unless it would cause a retain cycle). So keep the dealloc but also make sure your other object retains the array and releases it when it's done with it.

lord funk
Feb 16, 2004

Finally got an iPad for development. :dance:

Is there a way to disable scroll touches in certain areas of a uiscrollview? I have vertical sliders that keep triggering the scroll action instead of changing the slider value. They're all together in a big group, so maybe I can just define a rect area that won't pass the touch to the scroll action. Anyone done this before?

Edit: it might work to put the sliders in their own uiscrollview which has scrolling disabled.
Edit: it doesn't.

lord funk fucked around with this message at 15:19 on May 2, 2011

modig
Aug 20, 2002

kitten smoothie posted:

This is a reply that's a week late, but I signed up as an individual so I could test on my device and then had my account converted to a company account when I was ready to sell stuff. Took only about a week to change it over and I just had to fax over a copy of the incorporation certificate I got from the state to document the company.

Should I not sell an App as an individual?

fankey
Aug 31, 2001

lord funk posted:

Finally got an iPad for development. :dance:

Is there a way to disable scroll touches in certain areas of a uiscrollview? I have vertical sliders that keep triggering the scroll action instead of changing the slider value. They're all together in a big group, so maybe I can just define a rect area that won't pass the touch to the scroll action. Anyone done this before?

Edit: it might work to put the sliders in their own uiscrollview which has scrolling disabled.
Edit: it doesn't.
Subclass UIScrollView and override touchesShouldBegin:withEvent:inContentView and return YES if you want the UIView that was touched to get it. Since you probably want quick response on your slider make sure to turn off Delay Content Touches in the scroll view or you will have to press and hold for a brief moment before the touchesShouldBegin will be called.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

modig posted:

Should I not sell an App as an individual?

I do and it doesn't seem to be a problem, though my app shows up under my personal name first, then my DBA company name after.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice
I'm working on a app with another developer, using hg as our source control. The one problem we're having is when we add files or groups. Is it possible to have files and groups somebody else added show up in the project? It's annoying to have to do a pull / update then manually drag new files into the project, and it would be wonderful to have them groups the same in both environments. Obviously it's not a huge deal, but it would be nice to have one less hoop to jump through.

LP0 ON FIRE
Jan 25, 2006

beep boop

samiamwork posted:

It depends on what you're trying to do, but if both objects need it then both should retain it (unless it would cause a retain cycle). So keep the dealloc but also make sure your other object retains the array and releases it when it's done with it.

I've put back the dealloc in the other class of my hero thats used in my level class. It makes sense now because the array is alloc'd.

In my level class my hero class object initialized like this: hero = [[HeroClass alloc] init];
It's later deallocated, but I never allocated the array in the level class. I just reference it like this:

NSValue *val = [hero.heroCollisPushPoints objectAtIndex:i];

Which seems to be working okay. I can actually change this array with replaceObjectAtIndex without any noticeable issues. When HeroClass is deallocated, heroCollisPushPoints should be dealt with too right?

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Lumpy posted:

I'm working on a app with another developer, using hg as our source control. The one problem we're having is when we add files or groups. Is it possible to have files and groups somebody else added show up in the project? It's annoying to have to do a pull / update then manually drag new files into the project, and it would be wonderful to have them groups the same in both environments. Obviously it's not a huge deal, but it would be nice to have one less hoop to jump through.

If you are both checking in changes to the Xcode project bundle, it should prompt you to merge them and thus combine both sets of changes. Most of that stuff is just plist XML so in theory it should merge fine.


NOG posted:

I've put back the dealloc in the other class of my hero thats used in my level class. It makes sense now because the array is alloc'd.

In my level class my hero class object initialized like this: hero = [[HeroClass alloc] init];
It's later deallocated, but I never allocated the array in the level class. I just reference it like this:

NSValue *val = [hero.heroCollisPushPoints objectAtIndex:i];

Which seems to be working okay. I can actually change this array with replaceObjectAtIndex without any noticeable issues. When HeroClass is deallocated, heroCollisPushPoints should be dealt with too right?

This should be fine. Generally if you aren't using threads and aren't calling release, you can be guaranteed that any objects you access within a single method will live for the duration of that method. Autoreleased objects get released at the end of that run loop iteration.

Since HeroClass allocated the array it is correct to have it dealloc it when HeroClass gets dealloc'd. Also remember that the array will retain any objects inserted to it and dealloc them when removed, so be sure you release the object after adding it to the array /or/ you can just allocate/init/autorelease right up front. When the pool releases at the end of the iteration the object still exists because the array still retains it.

lord funk
Feb 16, 2004

fankey posted:

Subclass UIScrollView and override touchesShouldBegin:withEvent:inContentView and return YES if you want the UIView that was touched to get it. Since you probably want quick response on your slider make sure to turn off Delay Content Touches in the scroll view or you will have to press and hold for a brief moment before the touchesShouldBegin will be called.

Actually, delay content touches solves the problem completely. The only downside is exactly why it's there in the first place, which is that the rest of the uiscrollview is full of buttons and sliders that catch the touch when you DO want to scroll.

I'll live with it, though. MOVING FORWARD NOW...

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Lumpy posted:

I'm working on a app with another developer, using hg as our source control. The one problem we're having is when we add files or groups. Is it possible to have files and groups somebody else added show up in the project?

Add the .xcodeproj to the repo, then add the user-specific stuff to your hgignore (that's a gitignore, but I think the syntax is close if not identical).

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
Shameless self-promotion: I don't know if any of you remember Storm Sim from the previous iOS dev thread, but Storm Sim 2.14 just went live. It now has an iPad native UI which is pretty much the only change for this version.

App Store Link


It was a bit of a PITA to get going because it wasn't clear in Xcode4 exactly how to iPad-enable an app without having Xcode take a big fat dump all over the project. The way the XIB files ended up organized was nuts and I was seeing it load the iPhone views on the iPad simulator in some cases (but stopping and starting the process would fix it).

I realized I hadn't noticed at first because my iPhone views were mostly well-designed and supported any orientation, so they just scaled themselves to the iPad screen. That gave me an idea and I ended up deleting the iPad-specific XIBs for a number of views and just using the same exact view on both platforms. So the sleep timer, add effect, etc screens are all identical and just get shown in a popover on the iPad vs getting pushed on the navigation stack on the iPhone.

Also a protip: when you create a view for a universal app (or an iPad app) and want the view to have a smaller size, delete the default "View" from the XIB (Xcode won't let you change the view size). Then drag a new View object onto the canvas and hook it up to the file's owner "view" outlet. Now you can change its size, yay!

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Ender.uNF posted:

Also a protip: when you create a view for a universal app (or an iPad app) and want the view to have a smaller size, delete the default "View" from the XIB (Xcode won't let you change the view size). Then drag a new View object onto the canvas and hook it up to the file's owner "view" outlet. Now you can change its size, yay!

Holy hell that got annoying, thanks!

kitten smoothie
Dec 29, 2001

modig posted:

Should I not sell an App as an individual?
You certainly can. I already had an LLC for my programming-related side jobs and I realized it would be easier for my accountant to handle everything come tax time if I did my App Store shenanigans under that LLC too.

Nybble
Jun 28, 2008

praise chuck, raise heck

kitten smoothie posted:

This is a reply that's a week late, but I signed up as an individual so I could test on my device and then had my account converted to a company account when I was ready to sell stuff. Took only about a week to change it over and I just had to fax over a copy of the incorporation certificate I got from the state to document the company.

This is great to know. I think I'm about done with incorporation anyway, but haven't gotten word from Delaware yet. I may end up doing this. Does it show your name and your company next to your app? Or just the company?

kitten smoothie
Dec 29, 2001

Nybble posted:

This is great to know. I think I'm about done with incorporation anyway, but haven't gotten word from Delaware yet. I may end up doing this. Does it show your name and your company next to your app? Or just the company?

Just the company, same as it is if you were EA, Rovio or some other huge publisher.

The one caveat I've heard is to not set up your tax/banking info in iTunes Connect until you've converted your account. It was smooth sailing for me because I did absolutely nothing in ITC until after I converted.

But, I saw a blog post or two out there suggesting that if you already load your personal SSN, etc. in there and then converted, you can't just go in and change it to your corporate EIN and other info, and someone from Apple would have to take care of that for you. I don't know how much truth there is to it but I'd throw it out there.

Also, during the week or so it takes them to ask for and review your documents and convert your account, your account is locked out of the developer program website. Apple should remind you of this when you call in to start the conversion, but be sure to snag all your provisioning profiles and signing certificates you need to continue developing before you go through the process. Whatever you have saved in Xcode will still work, and converting won't invalidate the keys, but you'll temporarily lose access to the online provisioning portal and you might risk losing the ability to test on your device for a week if you don't save all your app signing related crap.

kitten smoothie fucked around with this message at 05:32 on May 3, 2011

modig
Aug 20, 2002
Is anybody comfortable sharing some sales numbers/experience, roughly speaking?

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
It varies so widely, there's no telling. Getting featured in the Games category can translate into thousands and if you are lucky enough from that to hit the top 10 that's worth millions. Other categories have different dynamics.

I released in mid-January. The highest Storm Sim ever got was 98 on the Health & Fitness chart. So far I've paid back my licensing costs, iOS dev membership, and bought an iPad. If I'm lucky and sales continue, it will buy me a new MBP this year. About 10-20% of revenue comes from in-app downloads. I just enabled iPad support and am waiting to see if that has any effect.

Storm Sim Free hasn't really been doing much, maybe $100 total since it was launched... If I were doing it over, I don't think I would have bothered with the free version. It just isn't the kind of app people spend a lot of time looking at the UI for so it just doesn't generate iAd revenue.


Overall I'm happy with it. I've spent more time on consulting projects that paid less (assuming sales numbers hold). I can't quit my day job by any means, but I plan on continuing to put out apps.

kitten smoothie
Dec 29, 2001

I've made about $350 on a very niche app since releasing it 3 months ago. Honestly I'm really surprised it's made that much, and I continue to get a download or two a day usually. For what basically amounted to a weekend project, that doesn't seem like a terribly bad return on my time.

I have a few more ideas with wider appeal, so I hope I will have better results later this summer when I time to get those out the door.

HiriseSoftware
Dec 3, 2004

Two tips for the wise:
1. Buy an AK-97 assault rifle.
2. If there's someone hanging around your neighborhood you don't know, shoot him.
My game Art of Deflection was released back in June 2009 and even though I do no marketing or exposure whatsoever now I still get about 2 sales a day, sometimes higher on the weekends. Overall I think I've made at least $700-800... unfortunately iTC Mobile (which is a fantastic app) only goes back 26 weeks so I don't have all of the numbers right in front of me. The first-day sales for releases and updates were lower than I expected, and there was a long time when I was getting no sales or maybe 1 or 2 a week but it's pretty steady lately. Steadily low, but steady.

And from what I can tell, I haven't had any bad experience with pirated copies... Googling the game brings up a cracked version, and I tried to obfuscate my anti-piracy measures as much as possible, but I haven't seen any crazy amount of players on OpenFeint that would suggest a pirated version. I don't have a jailbroken device so I can't say for certain if my anti-piracy measures worked. If not, then I hope it at least kept the crackers busy.

lord funk
Feb 16, 2004

I added some tab buttons to quickly jump between text boxes, but they react horribly when you try and use them. If you type in a number, then quickly tap the tab button, it 'corrects' your tap and presses 'Delete' instead.



This is kind of annoying, since the point of the tab buttons was to speed up data entry. Is there a way to force the tab button layer to get tap preference?

LP0 ON FIRE
Jan 25, 2006

beep boop

kitten smoothie posted:

I've made about $350 on a very niche app since releasing it 3 months ago. Honestly I'm really surprised it's made that much, and I continue to get a download or two a day usually. For what basically amounted to a weekend project, that doesn't seem like a terribly bad return on my time.

I have a few more ideas with wider appeal, so I hope I will have better results later this summer when I time to get those out the door.

Congratulations! It's inspiring to hear this.

That said, I'm trying to learn more about key-value coding. I've been wanting to accomplish a specific idea I have, but I don't know if it's the best approach or even possible.

Take this method call from another class for instance:
int blocksCollidableGID = [debugZoneLayer getGID:tileCoord forKey:@"blocksCollidable"];

Is it possible to take the key when that method is called, and have it equal the name of a Cocos2D CCTMXLayer? What would the method look like?

So to be more specific, when the method is called, it would know that I'm trying to get the tile coordinate of CCTMXLayer blocksCollidable.

LP0 ON FIRE fucked around with this message at 17:51 on May 4, 2011

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

NOG posted:

That said, I'm trying to learn more about key-value coding. I've been wanting to accomplish a specific idea I have, but I don't know if it's the best approach or even possible.

...

So to be more specific, when the method is called, it would know that I'm trying to get the tile coordinate of CCTMXLayer blocksCollidable.

I'm sure you've had a look at the Key-Value Coding Programming Guide. Specifically, I mean the part where it discusses resolving key paths to values. If a method with the same name as the key is implemented, it gets called and its return value is the value for the key path. Otherwise, if an instance variable with the same name exists, its value is returned.

So if you want [layer valueForKey:@"collidableCoordinate"] to give you tile coordinates, implement -collidableCoordinate on the class of layer. If it's not a class you control, implement it in a category (with a prefix, like -nog_collidableCoordinate). Also keep in mind that the return value from -valueForKey: will be boxed (i.e. an NSValue or subclass as opposed to an int/float/struct), so you'll likely need to unbox it first.

Zhentar
Sep 28, 2003

Brilliant Master Genius

Ender.uNF posted:

If you are both checking in changes to the Xcode project bundle, it should prompt you to merge them and thus combine both sets of changes. Most of that stuff is just plist XML so in theory it should merge fine.

Except that if you're both adding stuff at the end of the list, it'll conflict (easy enough to resolve though). And if you're messing with groups you can break things even without conflicts. Combine the terrible usability and miserable performance of XCode4's visual diff with several developers on a large project and you're not going to have a good time.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Zhentar posted:

Except that if you're both adding stuff at the end of the list, it'll conflict (easy enough to resolve though). And if you're messing with groups you can break things even without conflicts. Combine the terrible usability and miserable performance of XCode4's visual diff with several developers on a large project and you're not going to have a good time.

Oh sorry, I forgot to mention that I use Mercurial (MacHg) so that stuff is a non-issue for me. I put everything in source control anyway... artwork, design notes, test projects, and all the other misc. crap that goes along with a product.


On an unrelated note does anyone around here speak German (or any non-English languages)? I want to translate my app but I don't have the resources to haul off and do it on my own. I need a native speaker who is willing to help perhaps in exchange for something you can only get in the US, a gift basket, or a small fee.

My only other option is Google Translate, which I'm sure would do fine on single words but will simply mangle the description.

Also, does anyone know if you are required to keep the "what's new" stuff up to date in each language once you enable them?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Ender.uNF posted:

On an unrelated note does anyone around here speak German (or any non-English languages)? I want to translate my app but I don't have the resources to haul off and do it on my own. I need a native speaker who is willing to help perhaps in exchange for something you can only get in the US, a gift basket, or a small fee.

Hit up SA-Mart or the thread for the given language in the academics (?) subforum.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice
I have a conceptual question: The app I am working on shows a list of video mail messages. The messages (video files) are being downloaded in the background and I want to provide an activity indicator to the user, preferably a UIProgressView. I know how to do this in a "normal" view, so tying the progress bar to the DL isn't the problem, it's how do I deal with this in a table view? Do I make a single UIProgressBar and hang onto it in the class, and add it to the cell view of the appropriate cell (but then what happens if / when I reuse that cell?) Do I give every cell a progress bar, and only show it in the appropriate cell? If so, how do I handle it's delegate as it pops in and out of existence on scroll?

Small White Dragon
Nov 23, 2007

No relation.
Can I have my UIViewController be transparent to the one behind it?

Adbot
ADBOT LOVES YOU

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Lumpy posted:

Do I make a single UIProgressBar and hang onto it in the class, and add it to the cell view of the appropriate cell (but then what happens if / when I reuse that cell?) Do I give every cell a progress bar, and only show it in the appropriate cell? If so, how do I handle it's delegate as it pops in and out of existence on scroll?

Sounds easier to me to have give a progress indicator to each cell, then have some way to toggle the cell's state between 'loading' and 'loaded'. Like in iTunes.app when you download multiple files, they all have their own progress bar that sits there doing nothing until it's that file's turn to download.

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