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
Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
If anyone is willing to help me beta test my next release of Storm Sim, please hit up http://bit.ly/kE81Fe. I will be happy to return the favor with your next project by testing it on an iPod Touch, iPhone 3GS, and iPad2.

I just need to check for bugs (and am always happy to entertain comments about the UI / user experience).


I think it would be awesome if we could get a little beta exchange thing going to help each other out.

Adbot
ADBOT LOVES YOU

skidooer
Aug 6, 2001

Flobbster posted:

Wait, so you implemented a UITextView that does syntax coloring? Can you give any tips?
It was pretty easy, really. I inserted a custom view that does the CoreText drawing into the UITextView view hierarchy and used a UITextViewDelegate to tell the custom view when the text has changed and needs to be redrawn. The trick is to use the same font all the way through, otherwise your text will not line up with the cursor/other controls.

I will note that UITextView isn't really designed to be used this way so use at your own peril. It would be a pretty nice addition to the SDK though, given how easy it would be to add.

Zhentar
Sep 28, 2003

Brilliant Master Genius

Ender.uNF posted:

Have you tried to duplicate it's keyboard scroll functionality when moving between UITextView cells? Perhaps I'm totally missing something here.

I'm not familiar with the specifics of the built in functionality, but I didn't find it particularly difficult to handle for the situations I've encountered.

lord funk
Feb 16, 2004

Could someone play professor for a minute and :eng101: me about how to use ViewControllers correctly? I've made a bunch of beginner mistakes in my current app (putting logic data in UIViews, for example). I've researched Model-View-Controller by reading up on it on the dev site, and watching some WWDC videos.

But... in the WWDC 2010 Session 116 video (about 45:00 in), the presenter says that it's preferable to use multiple view controllers to keep views / data well paired, rather than have one giant mega view controller -- even in the context of one screen on the iPad. Everywhere I look, though, Apple says to use one view controller per screen.

So here's a stripped down version of my design:



The ViewController is becoming massive. Not only is it handling the display of all the custom subviews (there are dozens of them to be shown / not shown), but it's also acting as the delegate for the interactions within them.

Here is what I *think* the video is proposing:



Is this
1) possible, and if so, how?
2) wise?
...or am I way off?

echobucket
Aug 19, 2004

lord funk posted:

Could someone play professor for a minute and :eng101: me about how to use ViewControllers correctly? I've made a bunch of beginner mistakes in my current app (putting logic data in UIViews, for example). I've researched Model-View-Controller by reading up on it on the dev site, and watching some WWDC videos.

But... in the WWDC 2010 Session 116 video (about 45:00 in), the presenter says that it's preferable to use multiple view controllers to keep views / data well paired, rather than have one giant mega view controller -- even in the context of one screen on the iPad. Everywhere I look, though, Apple says to use one view controller per screen.

So here's a stripped down version of my design:



The ViewController is becoming massive. Not only is it handling the display of all the custom subviews (there are dozens of them to be shown / not shown), but it's also acting as the delegate for the interactions within them.

Here is what I *think* the video is proposing:



Is this
1) possible, and if so, how?
2) wise?
...or am I way off?

I think your application with it's myriad of controls all littered on one screen is an edge case.

One might argue except for specialized applications that throwing up an "airplane cockpit" of controls at the user is probably the wrong thing to do.

I can see if for professional audio type applications though....

lord funk
Feb 16, 2004

echobucket posted:

I can see if for professional audio type applications though....

Bingo.

echobucket
Aug 19, 2004

lord funk posted:

Bingo.

Then I would be inclined to break it up into multiple view controllers since you have so many.

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

lord funk posted:

Bingo.

The idea of one controller per screen is really pre-ipad advice.

Don't get too caught up in the architecture stuff; When you create your custom subviews, they should expose an API that makes sense for that view (without caring about the why or logic behind it). Then the controller can interact with them as if they were text fields or any other control.

Your proposed design looks fine to me and if it becomes unmanageable, just refactor later.


edit: and I will also point out that echobucket's advice isn't wrong either... at some point it's just a design decision and if you try to force it to match some arbitrary "rule" you'll only make life harder on yourself.

lord funk
Feb 16, 2004

Alright, thanks. There's always a lingering feeling that your doing it wrong when you teach yourself this stuff.

Zhentar
Sep 28, 2003

Brilliant Master Genius

Ender.uNF posted:

The idea of one controller per screen is really pre-ipad advice.

Even with a reasonably complex iPhone app, sticking to one controller per screen can be restrictive.

I think the primary motivation behind Apple's one controller per screen advice is that if you want to implement nested view controllers, you're responsible for passing all of the calls like -viewWillAppear: that are typically handled by the framework.

stray
Jun 28, 2005

"It's a jet pack, Michael. What could possibly go wrong?"
I'm an ObjC and iOS app development newbie and I can't figure this one out.

I've set up an app which has a few views, all running through a Navigation View Controller.
- The RootView is just a blank view with one button (labeled "branch listing") which, when tapped, pushes a table view of library branches (called BranchListing) onto the stack.
- When you tap an entry in BranchListingViewController, it pushes in another view, BranchDetailViewController.

The problem is this: when you tap an entry in the BranchListing view to see that particular BranchDetail view, the "back" button is present. However, there's no "back" button on the BranchListing view to go back to the RootView. In short, it's a one-way trip, once you tap the RootView's "branch listing" button; there's no going back.

Now, I could probably just tell the BranchListing view to include a Navigation Item and push the RootView onto the stack when it gets tapped, but that seems... wrong? Or am I just being paranoid? Would loading these views over and over result in memory problems, or is that exactly how you're supposed to do it?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

stray posted:

The problem is this: when you tap an entry in the BranchListing view to see that particular BranchDetail view, the "back" button is present. However, there's no "back" button on the BranchListing view to go back to the RootView. In short, it's a one-way trip, once you tap the RootView's "branch listing" button; there's no going back.

When you push the branch listing on to the navigation stack, the back button should show up for you automatically. Are you sure you're sending -pushViewController:animated: to the UINavigationController? Is the RootView properly set as the root view controller of the UINavigationController?

Feel free to post some code for us to help you with.

Echo Video
Jan 17, 2004

Check to see if the view controller for the rootview has a title set on its navigationItem property ( http://developer.apple.com/library/...INavigationItem ). I think if it's not set, the app won't display a back button automatically.

Echo Video fucked around with this message at 07:19 on Jul 6, 2011

stray
Jun 28, 2005

"It's a jet pack, Michael. What could possibly go wrong?"
Here's the method in RootViewController.m that pushes us into the branch listing:
code:
- (IBAction)branchListingButtonTapped:(id)sender {
	NSLog(@"Branch Listing button tapped");
	
	// Load new view and push it onto the stack.
	BranchListingViewController *branchListingVC = [[BranchListingViewController alloc] 
						initWithNibName:@"BranchListingViewController" 
						bundle:nil];
	[self.navigationController pushViewController:branchListingVC animated:YES];
	[branchListingVC release];
}
Does that help? What else should I post?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Looks fine to me, and I can't think of any other bright ideas.

I noticed in iOS 5 there's a note about leaving the title property of the view controller empty and that that's ok, but the same note is missing in the iOS 4 docs. Did you try setting a title like Echo Video suggested?

Echo Video
Jan 17, 2004

pokeyman posted:

Looks fine to me, and I can't think of any other bright ideas.

I noticed in iOS 5 there's a note about leaving the title property of the view controller empty and that that's ok, but the same note is missing in the iOS 4 docs. Did you try setting a title like Echo Video suggested?

I had to revise my post - it's not due to having the title of the view controller not set, it's having title of the navigationItem for the view controller not set. I have this line:

code:
self.navigationItem.title = @"My Fridge";
in my viewDidLoad method for my root view controller (it should probably go in initWithNibName). Without that line, nothing shows up for the title in the navigation bar and no back button is present when a new view controller is pushed onto the navigation stack. This is in iOS 4.3.

e: just tested if self.title works as well as self.navigationItem.title , it does.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Echo Video posted:

I had to revise my post - it's not due to having the title of the view controller not set, it's having title of the navigationItem for the view controller not set. I have this line:

code:
self.navigationItem.title = @"My Fridge";
in my viewDidLoad method for my root view controller (it should probably go in initWithNibName). Without that line, nothing shows up for the title in the navigation bar and no back button is present when a new view controller is pushed onto the navigation stack. This is in iOS 4.3.

e: just tested if self.title works as well as self.navigationItem.title , it does.

That's really good to know, thanks for trying it out. Dunno if it fixes stray's problem but I could see myself getting tripped up by this.

stray
Jun 28, 2005

"It's a jet pack, Michael. What could possibly go wrong?"

pokeyman posted:

Looks fine to me, and I can't think of any other bright ideas.

I noticed in iOS 5 there's a note about leaving the title property of the view controller empty and that that's ok, but the same note is missing in the iOS 4 docs. Did you try setting a title like Echo Video suggested?

Yep, that was it. Setting self.navigationItem.title did it. Thanks, you guys!

chaosbreather
Dec 9, 2001

Wry and wise,
but also very sexual.

I believe I am suffering from a responder chain issue that I hope some kind person can help me with. I currently have cut: copy: paste: and delete: implemented in my NSWindowController subclass, with validateUserInterfaceItem: just returning YES, but despite this the edit menu items that would activate these methods remain greyed out.

Since the whole of the window is a WebView, I have reason to believe that perhaps it is this WebView or a sub-view such as FrameView that is not only claiming itself first responder but is not letting my window controller have a crack at them like some jealous garden snake. How do I reason with this garden snake, to continue to let it do its thing whilst editing text (which it is capable of very well), and when it isn't to allow my window controller take control and enable these critically useful menu items for its own sinister purposes?

badjohny
Oct 6, 2005



Never mind...I am obviously very new to this :\

badjohny fucked around with this message at 19:38 on Jul 8, 2011

AlwaysWetID34
Mar 8, 2003
*shrug*
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

AlwaysWetID34 fucked around with this message at 17:29 on Jan 18, 2019

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

Ender.uNF posted:

If anyone is willing to help me beta test my next release of Storm Sim, please hit up http://bit.ly/kE81Fe. I will be happy to return the favor with your next project by testing it on an iPod Touch, iPhone 3GS, and iPad2.

I just need to check for bugs (and am always happy to entertain comments about the UI / user experience).

I think it would be awesome if we could get a little beta exchange thing going to help each other out.

Apparently everyone here has plenty of testers and devices? Seriously... no one is interested in a testing/beta exchange to help test each other's apps?

edit: one taker; Maybe we can get a wiki or something where we can list our current testflight teams or maybe the OP can keep the list. I've been thinking of trying to collect all my protips in one place as well.



McFunkerson posted:

I just found a cool little App called MajicRank that keeps track of your AppStore top 200 ranking position in multiple stores world wide.

Is there anything that will do the same thing, but with reviews and supports the Mac App Store? I tried googling but I could find links to websites that no longer existed.

Apple should really have something for store reviews in iTunes Connnect. It's a fairly important thing, and it's a pain changing your store location and find your app for every country.

I use AppFigures.com; it cost money if you want it to be really useful (like auto-downloading from iTC every day) but it is worth it to me. I lost a few days of sales reports when Apple changed iTC and the app I was using just silently said there were no reports to download.

Simulated fucked around with this message at 23:35 on Jul 8, 2011

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

chaosbreather posted:

Since the whole of the window is a WebView, I have reason to believe that perhaps it is this WebView or a sub-view such as FrameView that is not only claiming itself first responder but is not letting my window controller have a crack at them like some jealous garden snake.

Test this out by instantiating an instance of your window controller without a web view.

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen

Ender.uNF posted:

Apparently everyone here has plenty of testers and devices? Seriously... no one is interested in a testing/beta exchange to help test each other's apps?

I'm in. Can't have enough testers given the modern breadth of iOS devices, OSes and configurations out in the wild.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
I'm setting up a wiki, I will post more soon.

stray
Jun 28, 2005

"It's a jet pack, Michael. What could possibly go wrong?"
OK, here's another one. I'm trying to add an image of the branch to BranchDetailViewController that loads a small (~25KB) PNG-8 photo of the branch. I added a UIImageView in IB called branchImageView, which is where I'm trying to put the image.

This is the part of my viewDidLoad method dealing with the images:
code:
// Load the branch's image into branchImageView.
UIImage *img = [UIImage imageWithContentsOfFile:
				[[NSBundle mainBundle] 
				 pathForResource:[branchDetails objectForKey:ABBREVIATION] 
				 ofType:@"png"]];

// Now, let's test that the image loaded correctly before using setImage.
if (img == nil) { // Image failed to load
	NSLog(@"UIImage *img failed to load");
	img = [UIImage imageWithContentsOfFile:
		   [[NSBundle mainBundle] 
			pathForResource:@"NONE" ofType:@"png"]];
} else { 
	NSLog(@"UIImage *img loaded successfully");
} 
[branchImageView setImage:img];
[branchImageView setUserInteractionEnabled:NO];	
// Release the image now that we have a UIImageView that contains it.
[img release];
It... almost works. When you go into the BranchDetail view, it loads the image correctly. When you tap BACK in the nav controller to go back to the full listing, it crashes in main.m with the message: Thread 1: Program received signal: "EXC_BAD_ACCESS". I can't seem to figure out why that's happening.

Edit: God dammit, of course! Thanks, Mikey-San.

BONUS POINTS: Is there a way to move the branch images into their own folder in the project and still access them? I'm a folder neatnik and I don't want 80 images cluttering up my project folder when I don't need to access them all the time.

stray fucked around with this message at 03:31 on Jul 9, 2011

Mikey-San
Nov 3, 2005

I'm Edith Head!

quote:

code:
// Release the image now that we have a UIImageView that contains it.
[img release];

You don't own that image. Don't release it.

Echo Video
Jan 17, 2004

Yeah, imageWithContentsOfFile returns an auto-released image already so you don't need to call release. EXEC_BAD_ACCESS means you're calling some object which has already been deallocated.

There's an acronym to remember what methods created an already-retained object: NARC. Methods with New, Alloc, Retain, and Copy generally (I dunno about always) return retained objects. Everything else is autoreleased.

If you run into a lot of these problems, check out NSZombieEnabled for a way to debug them.

Bonus question: check out the imageNamed method of UIImage.

Doc Block
Apr 15, 2003
Fun Shoe
A class method like imageNamed or imageWithContentsOfFile (a so-called convenience method) is going to return an object you don't own. The way to think of it is that if you didn't create the object explicitly, but instead got it from a convenience method, then you don't own it and shouldn't release it (unless the method's docs say otherwise).

stray
Jun 28, 2005

"It's a jet pack, Michael. What could possibly go wrong?"

Echo Video posted:

Bonus question: check out the imageNamed method of UIImage.
Ah, useful! Thanks.

Doc Block
Apr 15, 2003
Fun Shoe
I have a Mac programming question. Once I'm done with the iPad app I'm working on I want to do a Mac app.

This will be a content creation app and I want it to be able to use plugins. Right now my idea is for plugins to be compiled as shared libraries, load them with dlopen(), and call a C function inside the plugin (load_PLUGINNAME or something) that creates an instance of the plugin and returns a pointer to it.

My question is: is there a better way? A more Objective-C/Cocoa-ish way?

dizzywhip
Dec 23, 2005

I have almost no experience with this, but I'm pretty sure that Cocoa Bundles are exactly what you're looking for.

http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingCode/LoadingCode.html%23//apple_ref/doc/uid/10000052-SW1

Campbell
Jun 7, 2000
I have a question about In-App purchases that I getting conflicting answers on.

I was under the impression that compiled code/app logic must all exist in the installed version of the app. An In-App purchase allows you to accept payment and receive an approval flag so you can download content into the app (or just flag something already in the app as usable). That content doesn't change the executable at all, but could be update data/images/etc that the app already knows how to interpret.

I'm being asked if its possible to can create a native iOS "portal app" that will allow you to download and play various games. I was 99% of the way into saying Apple doesn't allow interpreted code but then I found the C64 app which appears to do just that.

I'm guessing that the app either 1) already has the games built into the binary, or 2) downloads and actually interprets BASIC to present the game (I thought this was a big no-no, by the way) or 3) something else.

Anyhow, if you had any thoughts on if what's being asked is possible, it'd be cool because it's hurting my brain at this point!

Small White Dragon
Nov 23, 2007

No relation.

Campbell posted:

I'm being asked if its possible to can create a native iOS "portal app" that will allow you to download and play various games. I was 99% of the way into saying Apple doesn't allow interpreted code but then I found the C64 app which appears to do just that.

I'm guessing that the app either 1) already has the games built into the binary, or 2) downloads and actually interprets BASIC to present the game (I thought this was a big no-no, by the way) or 3) something else.

Anyhow, if you had any thoughts on if what's being asked is possible, it'd be cool because it's hurting my brain at this point!
When you download an App in iTunes, the IPA is just a ZIP file if you want to look inside it.

That said, it would appear that the games are already included.

Campbell
Jun 7, 2000
Ah yea, I'd forgotten to look in the IPA. While some of the games are included in a Games directory, they are in T64 (apparently c64 tape image format) and get parsed by the app.
New games from In-App purcahse are downloaded and interpreted on the fly, which seems pretty wild.

For modern games it seems like it'd be quicker and easier to just build out individual apps, rather than this hub-style.

Bah, just noticed all the in-app items listed as individual zip files, but inside those are no t64 files...no idea how those are delivered :/

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



The games are 6052 assembly, at least some of them.

.t64 = tape files, .d64 are disk files

I just took a look at Paradroid in the .ipa, it's a d64 with the REMEMBER +8 cracktro

Doc Block
Apr 15, 2003
Fun Shoe

Gordon Cole posted:

I have almost no experience with this, but I'm pretty sure that Cocoa Bundles are exactly what you're looking for.

http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/LoadingCode/LoadingCode.html%23//apple_ref/doc/uid/10000052-SW1

Thanks, that looks pretty helpful.

CeciPipePasPipe
Aug 18, 2004
This pipe not pipe!!

Carthag posted:

The games are 6052 assembly, at least some of them.

.t64 = tape files, .d64 are disk files

I just took a look at Paradroid in the .ipa, it's a d64 with the REMEMBER +8 cracktro

Haha, that's pretty interesting.

I had a look, too. Seems several of the games come packaged with LUA scripts that do memory hooking, almost in a debugger-breakpoint kind of way, and integrates with openfeint (and/or gamekit?) for internet highscores and achievements, pulling game state right out from absolute RAM addresses.


Edit a much more interesting question is the licensing situation wrt the actual emulator. It's pretty obvious it is using Frodo, which has a license that says (among other things), "you must not make any profit selling Frodo", and "it may not - not even in parts - used for commercial pursoses without explicit permission", and "you are not allowed to use the source to create and distribute a modified version of frodo". But maybe he's obtained special permission. Also, the .IPA contains "gpl.html", a full HTML copy of the GPL3 license text for some reason? (Frodo is _not_ licensed under the GPL, I believe)

CeciPipePasPipe fucked around with this message at 00:24 on Jul 13, 2011

SmirkingJack
Nov 27, 2002
I know that a Mac Developer account gives you access to previous and pre-release software, but does it give you access to current production software? For instance, if I purchase an account after Lion is released, will I be able to download it or would I be stuck with whatever the latest developer preview was before it was released?

Adbot
ADBOT LOVES YOU

Campbell
Jun 7, 2000

CeciPipePasPipe posted:

Haha, that's pretty interesting.

I had a look, too. Seems several of the games come packaged with LUA scripts that do memory hooking, almost in a debugger-breakpoint kind of way, and integrates with openfeint (and/or gamekit?) for internet highscores and achievements, pulling game state right out from absolute RAM addresses.

After first going up to the store, the app got pulled because of rule 3.3.2 against interpreted code. I'm kind of thinking that initially he was reading stuff at runtime, and then had to go and compile everything natively or something to get back on the store. The games folder then, being a relic of that original code. That doesn't answer anything about the emulator part though.

I'd love to know more about its architecture because it seems to do some pretty tricky stuff behind the scenes.

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