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
dizzywhip
Dec 23, 2005

Yodzilla posted:

We built a kiosk app for a conference and our answer to locking people into the experience was to build sort of a box that the iPad sat in which covered the home button. :downs: The client thought it was genius.

Hopefully he doesn't find out that you can still get back to the home screen with a five-finger pinch gesture. Or switch to different apps with four finger swipes.

Adbot
ADBOT LOVES YOU

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
It was early in the iPad's life when no one really knew that. Also it was a closed convention with a monitored station so it was more for the presenter's sake than any real security. :v:

yAak
Oct 28, 2011

Gordon Cole posted:

Hopefully he doesn't find out that you can still get back to the home screen with a five-finger pinch gesture. Or switch to different apps with four finger swipes.

You can disable this under Settings > Multitasking Gestures > OFF

Doc Block
Apr 15, 2003
Fun Shoe

Bob Morales posted:

Has anyone ever used this, or is it as crazy as it seems?

http://www.andescotia.com/products/marten/



:allears: pinstripes :allears:

LP0 ON FIRE
Jan 25, 2006

beep boop

ManicJason posted:

You can go full-on kiosk mode for enterprise apps, but it's not exactly user friendly.

I haven't tested it to see if it gets rid of the notification center drag-down thing.

Thank you so much! Just when I almost lost all hope, these things look very promising!

Yodzilla posted:

We built a kiosk app for a conference and our answer to locking people into the experience was to build sort of a box that the iPad sat in which covered the home button. :downs: The client thought it was genius.

This is what we were planning to do. We got a box but it didn't fit the iPad 3rd gen just because of the tiny bit of added thickness compared to the iPad 2.

LP0 ON FIRE
Jan 25, 2006

beep boop
Is there a way to selectively ignore pinch zoom on certain elements in a UIWebView?

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
So you can zoom on DivX but not DivY? To my knowledge those controls are per-page, not per-element. Just out of curiosity, why would you want that? Is there something within the UIWebView that you're trying to capture those commands with instead but you still want the entire view to be zoomable in general?

LP0 ON FIRE
Jan 25, 2006

beep boop
I just want to easily be able to zoom into a photo using the pinch gesture but have other buttons on top unaffected by the scrolling and zooming. The easiest route for this project is to stick to UIWebView since the rest of the project resides there.

I could conceivably somehow link a url to a UIScrollView by calling methods via javascript (but why and how) and lay standard buttons on top, but that would take some extra figuring out. I'd rather stick to UIWebView if it's possible.

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
What would happen if the global contents of your UIWebView that contained the menu had:

code:
<meta name="viewport" content="width=device-width; initial-scale=1.0; minimum-scale=1.0; maximum-scale=1.0; user-scalable=no;" />
But then the image/area you wanted to be zoomable was in an iframe and was set to:

code:
<meta name="viewport" content="width=device-width; initial-scale=1.0; minimum-scale=1.0; maximum-scale=1.0; user-scalable=yes;" />
And then for the UIWebView object itself set scalePageToFit = NO and multipleTouchEnabled = YES

I have no idea if that would actually work but it's worth a shot I guess.

LP0 ON FIRE
Jan 25, 2006

beep boop
It doesn't seem to work, and I'm guessing that's because the iframe inherits the pages user-scalable property. Just to make sure if I'm understanding correctly, I have one page with the user-scalable set to no and the page inside the iframe set to yes. I also made sure to have the iframe page max scale set higher than 1 so I could see some kind of effect when pinch zooming.

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
Yeah it was kind of a shot in the dark.

Another maybe slightly stupid idea, are there any javascript libraries to capture those gestures? If the gestures get passed through to the page and default zooming at the UIWebView level is still locked maybe you can capture them with javascript listeners and fake it by resizing the elements you want zoomable and such.

LP0 ON FIRE
Jan 25, 2006

beep boop
Yeah, zepto.js can capture pinch gestures. I'm just afraid it's going to be a pain in the rear end to implement and not have it work correctly. But that could just be me not feeling too ambitious anymore since it's the end of the day! I think I'll decide to start experimenting with that tomorrow morning with using zepto or trying to call an obj-c method with javascript to replace my UIWebView with a UIScrollView.

Apparently there's more than a few ways of calling obj-c methods or setting properties through javascript - most of which I've seen look hacky and overly complicated. Then I saw this, which to my surprise none of the other sites mention:
http://developer.apple.com/library/safari/#documentation/appleapplications/Conceptual/SafariJSProgTopics/Tasks/ObjCFromJavaScript.html

I haven't completely got my head around it yet. Does this look like what I need to have javascript call a obj-c method to replace my view and back again?

Thanks for all your help/suggestions.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
That's really cool. Unfortunately it seems to be OS X-only. Otherwise, yeah, you'd be set.

Bridging JavaScript and Objective-C through UIWebView is another one of those things I've reinvented a few times because, like you point out, all existing implementations seem overly complicated. Here's my most recent attempt to see my idea of simple. (Spoiler: it's not.)

The gist is you have your UIWebViewDelegate check for a certain made-up protocol. Then, in your JavaScript you set window.location to "madeup://whatever/you?want=here" and have your delegate intercept it and interpret it as necessary. To go the other direction, simply send -stringByEvaluatingJavaScriptFromString: to your UIWebView. Format your string however and it gets eval'd on the page.

Kallikrates
Jul 7, 2002
Pro Lurker
We had real good lucky using hammer.js http://eightmedia.github.com/hammer.js/ in our UIWebViews.

LP0 ON FIRE
Jan 25, 2006

beep boop

pokeyman posted:

That's really cool. Unfortunately it seems to be OS X-only. Otherwise, yeah, you'd be set.

Bridging JavaScript and Objective-C through UIWebView is another one of those things I've reinvented a few times because, like you point out, all existing implementations seem overly complicated. Here's my most recent attempt to see my idea of simple. (Spoiler: it's not.)

The gist is you have your UIWebViewDelegate check for a certain made-up protocol. Then, in your JavaScript you set window.location to "madeup://whatever/you?want=here" and have your delegate intercept it and interpret it as necessary. To go the other direction, simply send -stringByEvaluatingJavaScriptFromString: to your UIWebView. Format your string however and it gets eval'd on the page.

Thanks! I'm just starting to implement this now and try to figure it out along the way. I still don't completely understand it and it's hard to get my brains gears turning to understand it, but I bet it will be worth learning anyhow. I noticed that the webviewDelegate is imported both in the header and main files of the view controller. Is that necessary?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Nope, not necessary to #import in both. Doesn't hurt anything either, especially since #import only includes the file's contents once (as opposed to #include which basically does a copy/paste of the file every time you #include it).

LP0 ON FIRE
Jan 25, 2006

beep boop

Kallikrates posted:

We had real good lucky using hammer.js http://eightmedia.github.com/hammer.js/ in our UIWebViews.

I decided to go this direction. I really want to learn how to properly pass things back and forth between javascript and obj-c, but I need to stay ahead of schedule and I don't really need to deal with another technology. It's been tricky, but I got the pinch zoom to work from where it's started, but not without letting the image go out of bounds. Thanks for posting that!

Kallikrates
Jul 7, 2002
Pro Lurker
Their pinch to zoom example is very basic, and probably needs some improvement, but I last looked at it over 6 months ago. I also handle even.

It should also optimize to use on-click/tap where possible to speed up response.

zergstain
Dec 15, 2005

I'm using an NSArrayController subclass, and the contentArray binding key path might have a nil key in the middle. If this is the case, I want to make the add and remove buttons do nothing. What is the recommended way to detect this, and should I add IBOutlets to my subclass for the buttons?

Carthag Tuek
Oct 15, 2005

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



zergstain posted:

I'm using an NSArrayController subclass, and the contentArray binding key path might have a nil key in the middle. If this is the case, I want to make the add and remove buttons do nothing. What is the recommended way to detect this, and should I add IBOutlets to my subclass for the buttons?

Buttons have an "enabled" binding, bind that to the part that might be nil. If it's nil (evaluating to false, as opposed to non-nil evaluating to true), the buttons will be disabled.

numeric_atrophy
Oct 18, 2003

Download Geared - FREE
(17 Million Downloads)

Windows 8
iOS
Android
WinPhone 7
Anyone going to IndieCade this year?

zergstain
Dec 15, 2005

Carthag posted:

Buttons have an "enabled" binding, bind that to the part that might be nil. If it's nil (evaluating to false, as opposed to non-nil evaluating to true), the buttons will be disabled.

Had to attach a value transformer, but otherwise that worked. Thanks.

Froist
Jun 6, 2004

What's the general consensus on device support these days? I've been working on a game in my free time for longer than I'd like to admit (piggybacking on my work developer account for some testing on my iPhone 4), but now it's nearing the end I've finally got round to setting up my own dev account and spent last night trying to get it running on my 2G Touch.

The short story is Apple seem to be phasing out support for armv6 - new projects don't support it unless you change the build settings, and from Xcode 4.5 it sounds like you won't be able to build for armv6 at all. The more worrying point I saw mentioned somewhere (though I'm not certain over) was the suggestion that if an app is published now with a RequiredDeviceCapabilities flag of armv6, we wouldn't be able to push an update that removed this support, but equally wouldn't be able to build the update with Xcode 4.5, so it would mean keeping an old environment around.

Are people just dropping support for these devices at this point, given they're 3+ years old now?

(I also have a problem that my game just hangs when loading on the 2G Touch and I've no idea why, so the decision may be made for me.)

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane
Based on what I've seen, the majority of the Touch-sized market is occupied by the iPhone, since why the gently caress not get the thing that's also a phone? This means, at least in the US, that there's a very good chance most devices are newer than 3 years, because of the general rules for discounted hardware eligibility. Personally, I wouldn't worry too much about supporting such old devices, especially if it's already giving you headaches.

lord funk
Feb 16, 2004

Froist posted:

(I also have a problem that my game just hangs when loading on the 2G Touch and I've no idea why, so the decision may be made for me.)

Are you targeting for both iPhone and iPad? You may need to explicitly tell the device where the MainWindow.xib is in your Info.plist:

Only registered members can see post attachments!

lord funk
Feb 16, 2004

PT6A posted:

Personally, I wouldn't worry too much about supporting such old devices, especially if it's already giving you headaches.

This also goes for supporting older iOS versions. Like lots of you guys, I'm a one man developer. If targeting a more recent iOS version helps me get a good update out the door faster, that will make everyone happier.

Froist
Jun 6, 2004

lord funk posted:

Are you targeting for both iPhone and iPad? You may need to explicitly tell the device where the MainWindow.xib is in your Info.plist:



Oh no, it's Cocos2d based, nothing to do with Xib files. My main menu loads and works fine, but when I try to launch a game mode (where far more graphic resources would be loaded, so I'm probably running out of memory) it just hangs. Thanks for trying to help though!

lord funk posted:

This also goes for supporting older iOS versions. Like lots of you guys, I'm a one man developer. If targeting a more recent iOS version helps me get a good update out the door faster, that will make everyone happier.

Yeah, all through development I'd been staying away from using any iOS 5 specific APIs to maintain compatibility with my Touch, all to find out that it won't run anyway for other reasons. Given iOS 6 is supported all the way back to the 3GS it seems safe to just support the latest version and keep life easier.

Having said that, I found out recently that my boss (who's head of a large mobile app development group) has an iPhone 3GS that's still running iOS 3..

LP0 ON FIRE
Jan 25, 2006

beep boop
Can someone point me to a place that has some good information on how to run a script in build phases to find and replace text among different files? Anyone familiar with this?

I have some xml files that get generated by another program and I need to replace text with each of them. Since I generate these a lot, I'd just like it to be part of the build phase to find and replace that text.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
First, write the script. You can use anything that you can run from a shell. Since you're messing with XML files, I suggest writing something in your scripting language of choice (e.g. Ruby, Python, Perl) using the nearest XML library.

Once your script does what you want, open your Xcode project. Then go to your target, go to the Build Phases tab, and click 'Add Build Phase' on the bottom right. Pick 'Run Script'. Set the shell to the interpreter you used (e.g. /usr/bin/ruby) and copy/paste the script into the text box.

If you want to do this for multiple targets, you might be better off making a new target that does nothing but the Run Script step, then have the other targets depend on this new target.

LP0 ON FIRE
Jan 25, 2006

beep boop
Thanks! Didn't realize it had that much flexibility.

kitten smoothie
Dec 29, 2001

Froist posted:

Given iOS 6 is supported all the way back to the 3GS it seems safe to just support the latest version and keep life easier.

Having said that, I found out recently that my boss (who's head of a large mobile app development group) has an iPhone 3GS that's still running iOS 3..

I spent ten minutes doing an entirely unscientific survey of the compilations on the front page of the App Store. From eyeballing it, it seems like half the apps I found required armv7 devices. Of the other half, a good a 1/3 to 1/2 required iOS 4 or better. The iOS 4 requirement rules out any 1st-gen devices altogether, so you're now really just wondering how many 2nd-gen phones & touches are still in the wild.

From what I remember with my old iPhone 3G, iOS 4 ran like absolute garbage on it. So really, the people who are still hanging onto these old devices are already probably used to having a sub-par experience with it and your one app being incompatible isn't going to move the needle any either way.

mewse
May 2, 2006

pokeyman posted:

First, write the script. You can use anything that you can run from a shell. Since you're messing with XML files, I suggest writing something in your scripting language of choice (e.g. Ruby, Python, Perl) using the nearest XML library.

I dunno if it's a simple find and replace it seems like he'd do it faster by just calling sed:

Bash code:
#!/bin/sh
cat somefile.xml | sed 's/oldword/newword/g' > somefile-updated.xml
rm somefile.xml
mv somefile-updated.xml somefile.xml

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
If that works for you, perfect.

As soon as you start putting less-than or greater-than in your pattern, it's time for an XML library.

LP0 ON FIRE
Jan 25, 2006

beep boop

mewse posted:

I dunno if it's a simple find and replace it seems like he'd do it faster by just calling sed:

Bash code:
#!/bin/sh
cat somefile.xml | sed 's/oldword/newword/g' > somefile-updated.xml
rm somefile.xml
mv somefile-updated.xml somefile.xml

This seems a bit easier. I don't know the extent of sed, but I'd like to search files in my entire project for a string, replace it and save the changes to it or write over it with the same name.

mewse
May 2, 2006

pokeyman posted:

As soon as you start putting less-than or greater-than in your pattern, it's time for an XML library.

Agreedo

Carthag Tuek
Oct 15, 2005

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



Man pages are your friend:

Bash code:
#!/bin/sh
sed -i .bak -e 's/oldword/newword/g' somefile.xml
Remove the .bak part (but keep -i) for the same functionality as the other example (ie. overwrite the existing file).

Star War Sex Parrot
Oct 2, 2003

I've done a bit of Googling and found varying answers that are years old, so I'll ask here: is there a MASM counterpart for OS X? My instructor will be working with MASM and if possible I'd like to do something native with OS X, but am not averse to using the same VM that I'm already using for my .NET class. Thanks in advance.

Doc Block
Apr 15, 2003
Fun Shoe

Star War Sex Parrot posted:

I've done a bit of Googling and found varying answers that are years old, so I'll ask here: is there a MASM counterpart for OS X? My instructor will be working with MASM and if possible I'd like to do something native with OS X, but am not averse to using the same VM that I'm already using for my .NET class. Thanks in advance.

There's NASM, and while it's also an x86 assembler, if memory serves its syntax for stuff like indirect memory access and macros and stuff is different than MASM.

Carthag Tuek
Oct 15, 2005

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



nasm is part of the XCode install. Haven't used it, so I can't say how similar it is to masm.

Docs go into the differences a bit: http://www.nasm.us/xdoc/2.10.04/html/nasmdoc2.html#section-2.2

Adbot
ADBOT LOVES YOU

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

I just had a Computer Architecture class last semester where I tried to use NASM, but I found that there were just enough syntax differences to make translating a pain, and I had trouble getting the libraries we were using (which had been translated by one of the professors from the MASM library created by the textbook author) that I switched over to MASM in a VM after the first or second assignment.

Basically you'll spend too much time converting MASM to NASM (and back again, if you're turning it in) to make it worth the effort unless you're really interested in becoming an expert in assembler.

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