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
duck monster
Dec 15, 2004

Regarding non testflight stuff, google "Hockeykit".

Also this needs to be said. Because 3.5" screen apps look like arse on a 4" screen I'm officially hosed of with the iphone 5. To support the full screen I have to make it IOS6 specific. So I can choose between "lose customers for app" especially since practically everyone i know has decided to give IOS6 a miss due to the maps thing screwing (Its *really really* bad in australia.) and "look like arse on Iphone 5"

At least with retina before you could get away with it, because for the most part having a shittier resolution wasn't really noticable by most folks.

But this... god drat it. Aspect ratio change? really Apple?

I need to get another job. This is frusturating. loving fragmentation.

Adbot
ADBOT LOVES YOU

Doc Block
Apr 15, 2003
Fun Shoe
Umm, what?

You don't have to make the app iOS 6-only to still support the iPhone 5's taller screen. I have an app in the app store that runs on iOS 5 and yet on an iPhone 5 will take up the whole screen.

Just add an image called Default-568h@2x.png that's 1136x640 pixels, and the iPhone 5 will see that and make your app take up the whole screen.

You really need to quit jumping to conclusions and then blowing up every time something doesn't work exactly the way you think it should.

Carthag Tuek
Oct 15, 2005

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



It seems kitten smoothie got it to work without targeting iOS 6 though?

kitten smoothie posted:

Can I keep using 4.4 to build, put the Default-568h@2x.png file in there, and that's all it would take to force it to run in tall mode on an iPhone 5? Then if I'm being smart enough about laying out my UI relative to the window size, everything'd be great on either device?

Or do I need to actually build against 4.5 and the iOS 6 SDK?


kitten smoothie posted:

For what it's worth, it looks like you can in fact do this. So I can at least still keep supporting armv6 devices this way until I absolutely need to use an iOS 6 feature. If you build in 4.4 and include the 568h launch image, the phone will still stretch things properly.

I just had to fix autoresize on some of my UI elements and everything looks just dandy on an iPhone 5.

I couldn't use 4.4 to debug on an iPhone 5, so I had to do all that in 4.5. But then I could go and do an ad-hoc build in 4.4 with armv7 and armv6 support and have it work on the iPhone 5. Have not tried submitting to the store like this but probably will do that next week.


Edit:

Doc Block posted:

You really need to quit jumping to conclusions and then blowing up every time something doesn't work exactly the way you think it should.
He wouldn't be duck monster if he didn't :D

Doc Block
Apr 15, 2003
Fun Shoe
Also, 60+% of iPhones are now running iOS 6, 45+% of iPads, and 39+% of iPod Touches. source

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.
Does a 3.5" iPhone app appear stretched on the 4" screen or are there black bars, letterbox movie style? What would a game look like?

Doc Block
Apr 15, 2003
Fun Shoe
They get letterboxed.

On my black iPhone 5 it's hard to notice and not nearly as bad as I thought it would be (thanks largely to the iPhone 5's fantastic screen), but I imagine it'd be more pronounced on a white iPhone.

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane

HiriseSoftware posted:

Does a 3.5" iPhone app appear stretched on the 4" screen or are there black bars, letterbox movie style? What would a game look like?

Black bars.

And, yes, you can totally target iOS 5 and maintain support for the new, larger screen -- and it turns out that dealing with the larger screen is much less of a pain in the rear end than I'd anticipated.

Speaking of which: is everyone using [[UIScreen mainScreen] bounds].size.height == 568 to check for the larger screen, or I am doing it the stupid way again?

Doc Block
Apr 15, 2003
Fun Shoe
So far I haven't needed to check for the larger screen at all, but that's probably how I'd do it if needed.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
FWIW I had an update rejected for the reason "Invalid Launch Image - You app contains a launch image with a size modifier that is only supported for apps built with the iOS 6.0 SDK or later." when doing the Xcode 4.4 + Default-568h@2x.png thing.

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane

Plorkyeran posted:

FWIW I had an update rejected for the reason "Invalid Launch Image - You app contains a launch image with a size modifier that is only supported for apps built with the iOS 6.0 SDK or later." when doing the Xcode 4.4 + Default-568h@2x.png thing.

Ooooh... well, I guess we'll see how it goes, won't we?

EDIT: Mind you, I did build with the iOS 6 SDK, just using 5.0 as the deployment target.

Doc Block
Apr 15, 2003
Fun Shoe
Apple won't have a problem with you building with the iOS 6 SDK but setting the deployment target to something earlier, as long as your app actually works on the earlier version.

Khelmar
Oct 12, 2003

Things fix me.
I've got an NSImage question.

I'm trying to make a screensaver that uses images from a given directory as the images. My problem is that everything ends up much smaller than the actual image size. While I want that, to some degree, I want it just small enough to fit on the screen, not taking a 2000x3000 pixel image and shrinking it to a quarter of the screen...

I think I'm really screwed up on the whole scaling / resolution independence thing, but I'm lost and can't figure this out.

Here's the code:

code:
        NSURL *fileURL = [photoFilenames objectAtIndex:currentPhoto];
        NSImage *currentImage = [[NSImage alloc] initWithContentsOfURL:fileURL];
        
        NSSize imageSize = [currentImage size];

        NSLog(@"File: %@", fileURL);
        NSLog(@"Image size: %f x %f", imageSize.height, imageSize.width);
        
        NSPoint ori = SSRandomPointForSizeWithinRect(imageSize, rect);
        
        [currentImage drawAtPoint:ori fromRect:NSZeroRect operation:NSCompositeCopy fraction:1];
Here's an example image:
http://imgur.com/kVAxe

NSImage lists the image size as 721.920000 x 480.000000.

Any suggestions on what I've screwed up? Thanks!

Froist
Jun 6, 2004

Since when have we been able to access argument-less getter-style functions with the dot syntax? I've just noticed this seems to work with Xcode 4.5 and it works on my iOS 6.0 and 4.3 Simulators, but I'm pretty sure I couldn't do this a few weeks ago in Xcode 4.4.

Is it right to assume this is a completely compile-time feature (as opposed to ARC which IIRC has some caveats on earlier iOS versions) and I can use it everywhere to clean up my code?

Carthag Tuek
Oct 15, 2005

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



Yeah, if you feel insane you can even do things like NSObject.alloc.init but you shouldn't.

The cleanest is to use dot-notation if you're accessing a property, and don't if you're not. I personally declare my "getter-style functions" as readonly nonatomic properties in my .h and then make the method as usual in my .m.

E: This blog post sums it up nicely:

quote:

The biggest reason I see to use a different notation for both property declaration and property access than for method declaration and sending messages — even if property access ultimately results in a message send, as it does in Objective-C 2.0 — is separation of state and behavior.

http://eschatologist.net/blog/?p=160

Carthag Tuek fucked around with this message at 08:27 on Oct 9, 2012

dizzywhip
Dec 23, 2005

Froist posted:

Since when have we been able to access argument-less getter-style functions with the dot syntax? I've just noticed this seems to work with Xcode 4.5 and it works on my iOS 6.0 and 4.3 Simulators, but I'm pretty sure I couldn't do this a few weeks ago in Xcode 4.4.

Is it right to assume this is a completely compile-time feature (as opposed to ARC which IIRC has some caveats on earlier iOS versions) and I can use it everywhere to clean up my code?

As far as I remember I've always been able to do this, and I started during Xcode 3. You may have previously been trying to use dot notation on an id-typed object, which doesn't work. In general I like to use dot notation for anything phrased as a noun and bracket notation for verbs.

Froist
Jun 6, 2004

Carthag posted:

Yeah, if you feel insane you can even do things like NSObject.alloc.init but you shouldn't.

The cleanest is to use dot-notation if you're accessing a property, and don't if you're not. I personally declare my "getter-style functions" as readonly nonatomic properties in my .h and then make the method as usual in my .m.

Yeah, initialisation looks nasty. I've been coming round to using readonly properties for this type of thing, but my main need for it is singleton patterns within my game engine - in these cases (as they're static functions) I couldn't define a class-level property for them, so didn't realise I could dot-notate them. It definitely makes sense to restrict the usage to accessor-type functions rather than mutators though.

Gordon Cole posted:

As far as I remember I've always been able to do this, and I started during Xcode 3. You may have previously been trying to use dot notation on an id-typed object, which doesn't work. In general I like to use dot notation for anything phrased as a noun and bracket notation for verbs.

I think I'd been thrown off by the fact they don't auto-complete, combined with the fact I thought you could only use dot notation for properties, so I'd never actually tried it. You learn something every day :)

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
I have a button inside of a scrollview and something kind of weird is going on. It's not responding to clicks but rather if you want to activate the button you have to kind of press down on it and drag your finger a bit to get it to register. Why is this happening? Is the scrollview intercepting the standard tap? How do I fix this?

LP0 ON FIRE
Jan 25, 2006

beep boop
My morning has started off pretty nicely. I've been working on syncing that CAGradientLayer with a Cocos2D scene transition for about a month or more on and off, and I just figured it out.

Initially I was using t in CCActionEase because I noticed during transitions that variable changed as a percent as the transition start and ended. I sent that as a parameter to my delegate to change the frame position of my CAGradientLayer.

The results I got appeared really inaccurate so instead I went on to trying to seek the position of the scene, layer or whatever made what was drawn on the screen while the new "scene" slid on. I found the transition itself was the current scene to Cocos2D and locating the current position of what was being slid was going to be real long road ahead.

Last night and this morning I decided to go back to using t. Ultimately I wanted to change the CAGradientLayer's frame and the percent seemed to follow exactly with the transition. I found that there was nothing wrong with doing it that way in the first place. What happened, for whatever reason, is that changing the CAGradientLayer's frame was animating the new position. This is what made the CAGradientLayer appear jumpy and inaccurate. Every frame in Cocos2D told the gradient to animate to a new position and by the end of the transition, the layer still needed to catch up which threw it way off sync.

I added this line to my delegate's method before the CAGradientLayer's new frame is set: [bgLayer removeAllAnimations];

And now it works fine. :v:

Doc Block
Apr 15, 2003
Fun Shoe

Yodzilla posted:

I have a button inside of a scrollview and something kind of weird is going on. It's not responding to clicks but rather if you want to activate the button you have to kind of press down on it and drag your finger a bit to get it to register. Why is this happening? Is the scrollview intercepting the standard tap? How do I fix this?

Yeah, the scroll view is getting the touches first. It's so that if you're scrolling and your finger goes over a button the button isn't activated. Look at the delaysContentTouches property.

hedgecore
May 2, 2004
Found a critical bug after being approved. Cheers to Apple for acknowledging my expedited update request and ensuring I could hit my release date of today! Less excited about my app going up for sale yesterday as free by their mistake... but it's all good. Also thankful they didn't think selling an app under my very similar name was a problem.

http://popspotterapp.com
http://itunes.apple.com/us/app/popspotter/id564557375

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch

Doc Block posted:

Yeah, the scroll view is getting the touches first. It's so that if you're scrolling and your finger goes over a button the button isn't activated. Look at the delaysContentTouches property.

If I set the scrollView's delaysContentTouches to NO then I can't swipe left and right to different pages without triggering the button click. I guess ideally delaysContentTouches would be disabled so you don't have to hold your finger down for a good second before any sort of touch event on the button fires but now I don't know how to get the scrollView to differentiate between a swipe to change pages and UIControlEventTouchUpInside on the button itself.

Doc Block
Apr 15, 2003
Fun Shoe
That's weird that you have to hold down the button for a long time. It's set to trigger on the touch up inside event, right?

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
It's really hard to explain and I've had a few guys look at it and come away confused. What I have is a paging scrollView that contains all different kinds of content on each page. Some pages are images, some are PDFs and some contain a gigantic button that launches a popup video player.

By default I have the scrollView's delaysContentTouches = YES and the UIButton's action set to UIControlEventTouchUpInside. In this configuration if you quickly tap the button nothing happens. If you long-press on the button you get the button activation darkening like it's depressed but then when you pull your finger up nothing happens. To actually get the button to fire in this state you have to long-press on the button and then sort of smudge your finger a bit to get the action to fire.

Since the button is full-screen setting delaysContentTouches = NO made it so that the touch event immediately fired but then I could no longer swipe to a new page. I've come to a sort of happy medium by changing the button's action to UIControlEventTouchDown which removes the need to smudge your finger but it still requires the long-press to fire off.

I really wish I knew more about what was going on here as I have plenty of other buttons elsewhere in the app in non-paging scrollViews that don't have this problem.

Doc Block
Apr 15, 2003
Fun Shoe
That's really weird. However, you should be able to happily have delaysContentTouches set to YES and still have your button activate on UIControlEventTouchUpInside.

In fact, I made a little test app and it works fine: Swipe-O.

edit: make sure the scroll view's canCancelContentTouches property is set to YES.

Doc Block fucked around with this message at 21:10 on Oct 9, 2012

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
Well goddamn that works just fine. I'm going to have to really dig around and see what the hell is going on with mine because as far as I can tell I'm doing pretty much the same thing you are.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Yodzilla posted:

Well goddamn that works just fine. I'm going to have to really dig around and see what the hell is going on with mine because as far as I can tell I'm doing pretty much the same thing you are.

Like people are saying, make sure you have the IBAction bound to "Touch Up Inside". I had similar weird behavior at one point and it turned out I was binding to "Drag Up Inside" or somesuch :doh:

Yodzilla
Apr 29, 2005

Now who looks even dumber?

Beef Witch
Yeah the code for creating the button is as follows:

code:
UIButton *myButton = [UIButton buttonWithType:UIButtonTypeCustom];
myButton.frame = CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height);

UIImage *imageBack = [[UIImage alloc] initWithContentsOfFile:imagePath];
UIImage *imageFront = [UIImage imageNamed:@"play.png"];
CGSize newSize = CGSizeMake(frame.size.width, frame.size.height);
UIGraphicsBeginImageContext(newSize);
[imageBack drawInRect:CGRectMake((frame.size.width / 2) - (imageBack.size.width / 2),(frame.size.height / 2) - (imageBack.size.height / 2), imageBack.size.width, imageBack.size.height)];
[imageFront drawInRect:CGRectMake((frame.size.width / 2) - (imageFront.size.width / 2), (frame.size.height / 2) - (imageFront.size.height / 2), imageFront.size.width, imageFront.size.height)];
UIImage *buttonImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

[myButton setImage:buttonImage forState:UIControlStateNormal];

[myButton setAccessibilityValue:videoPath];
[myButton addTarget:self action:@selector(videoPressed:) forControlEvents:UIControlEventTouchUpInside];

[scrollView addSubview:myButton];
All of the image manipulation is just crushing a transparent play button on top of some other image for use in the button and removing that doesn't fix the issue in any way. I'll have some other guys here take a look at it and let you know if we come up with a solution as now I'm just really curious.

Doh004
Apr 22, 2007

Mmmmm Donuts...
Is there a simpler way of creating a UITablewView with a datasource of a NSMutableArray of a bunch of views then having to create a whole separate class/files (a la http://blog.willwinder.com/2010/10/uitableview-which-is-its-own-delegate.html )

I feel like I should just be able to create a UITableView in the code, set its datasource to my collection of views and be done with it. Am I just mistaken?

Doc Block
Apr 15, 2003
Fun Shoe
You can always set the datasource to be your view controller, so long as the view controller conforms to the UITableViewDataSourceDelegate protocol.

The guy in that tutorial is just showing a way to make a subclass of UITableView that takes an array of strings and shows them in the table view. You don't have to do it this way if you don't want to; creating a separate class for your UITableView's data source isn't necessary.

You cannot, however, just do myTableView.dataSource = myMutableArrayOfViews;

duck monster
Dec 15, 2004

I wonder how dangerous remarking arm6 .a files as arm7 is. We've got an old arm6 .a library from a closed source developer thats gone under and vanished off the face of the earth and welp xcode 4.5

In *theory* it should work, because arm7 can understand arm6 assembly. The reality might be very diferent.

Blackmagic voodoo using lipo. I must experiment...

duck monster fucked around with this message at 06:02 on Oct 10, 2012

Doh004
Apr 22, 2007

Mmmmm Donuts...

Doc Block posted:

You can always set the datasource to be your view controller, so long as the view controller conforms to the UITableViewDataSourceDelegate protocol.

The guy in that tutorial is just showing a way to make a subclass of UITableView that takes an array of strings and shows them in the table view. You don't have to do it this way if you don't want to; creating a separate class for your UITableView's data source isn't necessary.

You cannot, however, just do myTableView.dataSource = myMutableArrayOfViews;

Hmm okay, thanks.

Good practice question:

I have a tableviewcontroller whose cells consist of one view. Inside of those views consists of a bunch of various other views that I've built up. I'm interested in converting those views into tableviews so that their behavior will mimic the main tableviewcontroller (I want to be able to expand collapse individual views and I think the tableview will know how to handle that all).

I was going to implement this, but then I realized what I'm trying to do is similar to having multiple sections in my TableViewController. Would it be better to just have the section's header be my subview's header, and then its "children" be the actual subviews? Or should I stick to nested tableviews?

Sorry if this is poorly worded, I hope I conveyed the two choices correctly.

Khelmar
Oct 12, 2003

Things fix me.

Khelmar posted:

Any suggestions on what I've screwed up? Thanks!

Well, this may be a feature, not a bug, since when I run Apple's example code (Cocoa Slides) with the same images, they can only be sized up to what I'm getting in my code.

Doc Block
Apr 15, 2003
Fun Shoe

Doh004 posted:

Hmm okay, thanks.

Good practice question:

I have a tableviewcontroller whose cells consist of one view. Inside of those views consists of a bunch of various other views that I've built up. I'm interested in converting those views into tableviews so that their behavior will mimic the main tableviewcontroller (I want to be able to expand collapse individual views and I think the tableview will know how to handle that all).

I was going to implement this, but then I realized what I'm trying to do is similar to having multiple sections in my TableViewController. Would it be better to just have the section's header be my subview's header, and then its "children" be the actual subviews? Or should I stick to nested tableviews?

Sorry if this is poorly worded, I hope I conveyed the two choices correctly.

I don't know if it's technically possible to stick a tableView into another tableView's cell, but it probably isn't a good idea.

Having a nested list that can expand and contract seems like it would be easy enough if you we're already familiar with UITableView. I don't think it involves needing to mess with section headers.

I'm not at my computer right now or I'd look into it more for you, sorry.

Doh004
Apr 22, 2007

Mmmmm Donuts...

Doc Block posted:

I don't know if it's technically possible to stick a tableView into another tableView's cell, but it probably isn't a good idea.

Having a nested list that can expand and contract seems like it would be easy enough if you we're already familiar with UITableView. I don't think it involves needing to mess with section headers.

I'm not at my computer right now or I'd look into it more for you, sorry.

I actually ended up going with messing around with section headers and footers. While it has caused some pain because I had to set the style TableView style to Plain in order to prevent the headers from "sticking" to the top when you'd scroll, things are "working".

One issue I've run into is it seems my links are no longer tappable. I imagine the tap gesture isn't "passing" through (for a lack of a better term) the ViewCell to hit my link view?

Doc Block
Apr 15, 2003
Fun Shoe
Yeah, tapping on the cell is intercepted by the table view IIRC.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
Yep. I had to do some horrible things to UIKit a few months ago implementing a UITableViewCell/UITableView setup that has cells you can touch and drag out of scrollable tables. I'm sure there is a much better way to do it, but I had fun screwing around with hit tests and touch events to get it working without breaking anything else.

Doh004
Apr 22, 2007

Mmmmm Donuts...
Looks like I might just be able to do override shouldReceiveTouch:

http://stackoverflow.com/questions/10755566/how-to-know-uitableview-is-pressed-when-empty

tarepanda
Mar 26, 2011

Living the Dream
Going back to an old question of mine...

I'm trying to use ZBar to read QR codes, but I'm not finding explanations/examples of how to just scan a UIImage. I don't want to use ImagePickerController since the user isn't taking a picture or selecting an image -- that's done elsewhere automatically (and needs to be done there).

So I'll have a UIImage that I want to scan for a QR code (and if it's there, read it).

Looking at the docs, ZBarReaderController doesn't seem like what I want, but ZBarScanner does.

PROBLEM SOLVED!

code:
    ZBarImage *ZBImage = [[ZBarImage alloc] initWithCGImage:QRImage.CGImage];
    ZBarImageScanner *ZBScanner = [[ZBarImageScanner alloc] init];
    int results = [ZBScanner scanImage:ZBImage];
    
    if(results > 0){
        NSLog(@"QR Codes Found: %i", results);
    
        ZBarSymbol *symbol = nil;
    
        for(symbol in ZBImage.symbols)
            NSLog(@"%@", symbol.data);
    }
I'd forgotten that ZBarImage was a general data wrapper, not just an image. Duh. So easy.

Edit: Also, for the record, ZBar was much easier for me to install and get started with than ZXing.

tarepanda fucked around with this message at 11:44 on Oct 11, 2012

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
A CoreData-related question: is there a good time-proven pattern for iOS apps for abstracting the DB away from the rest of the system, so that the business logic only has to worry about reading and writing objects without needing to know anything about the insides? I find the juggling of the NSManagedObjectContext object around my business logic to be somewhat ugly and am looking for alternatives.

I'm tempted to just have a data access layer class that's just a bunch of static CRUD methods for each of the entities I have, but I'd love to know if there's a cleaner approach. I was thinking along the lines of:

code:
+getUserWithId:(NSString *)userId withBlock:(MyBlock)block;
+createUserWithFoo:(Foo *);
I'd keep all of the DB file locating and initialization hidden away through an internal singleton, initialized the first time you call any of the methods.
I'd also wrap all of the calls in a separate queue only used by the data access layer class so that it's all off the main thread and can only talk back through blocks. This gives your DB free thread-safety. Also, considering that I'll never need more than one object context and that I'll likely never do any kind of dependency injection, the static methods approach seems doable. I might be missing something though, so I'm hoping you can give me a hint.

Adbot
ADBOT LOVES YOU

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
You've got the right idea, or at least a perfectly doable one. For an example of this (taken too far for my taste), see MagicalRecord. One of its innovations is creating per-thread contexts behind the scenes of a static +[NSManagedObjectContext sharedContext] call, by using thread-local storage.

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