|
Is there any way to detect if there are "too many" touches on the device? I know that the iPhone supports 5 touches and the iPad has 11. I've got a soon-to-be-released kids app and of course my 3-year old finds a bug when he puts too many fingers on the screen. For example, on the iPhone, if I put 5 fingers on the screen at once, I get a bunch of e.g. touchesBegan events. If I keep those fingers down and put down one more, I get no events at all (not even touchesCancelled). I've been looking at functionality of some games and I see that they somehow detect that there's been a 6th touch and do things like reset "button is pressed" states, which would be perfect. If there's some other notification or event that I need, I can't seem to find it. Edit: Ok well it seems that I spelled it "touchesCanceled" and not "touchesCancelled" in the code so that's probably what's going on. Doh! HiriseSoftware fucked around with this message at 05:56 on Dec 15, 2014 |
# ? Dec 15, 2014 05:36 |
|
|
# ? May 17, 2024 15:57 |
|
I'm having a weird issue and for the life of me I can't get the right combination of terms in google to find a solution. I'm relatively new to this so the answer is probably right in front of my face but who knows. I'm using the SWTableViewCell project to fill a UITableView with data fetched from a webpage in an asyncronous call code:
code:
There is a UIScrollViewDelegate like so that does not get fired when the call to setUpView is asyncronous (but does get hit if called from the main thread), but does get hit right before the segue code:
|
# ? Dec 15, 2014 23:31 |
|
So I recently decided to start learning Objective-C so that I can make iOS apps, and it's pretty fun so far, but I'm having trouble with the iOS simulator in Xcode. When I'm messing with the View, I can see the entire iPhone screen, but when I run the simulator it's cut off at the right and bottom: The View (incredibly zoomed out so you can see that the entire thing is visible): The Simulator: If anyone could tell me how to fix this, I'd really appreciate it.
|
# ? Dec 16, 2014 01:12 |
|
Danyull posted:So I recently decided to start learning Objective-C so that I can make iOS apps, and it's pretty fun so far, but I'm having trouble with the iOS simulator in Xcode. When I'm messing with the View, I can see the entire iPhone screen, but when I run the simulator it's cut off at the right and bottom: Check your constraints.
|
# ? Dec 16, 2014 01:20 |
|
Is this the first year that they've permitted pricing changes during the iTunes Connect shutdown? I seem to recall them warning against changing your price in the previous years emails.quote:During this time, you will not be able to submit new apps, app updates, or In-App Purchases. You also will not be able to access iTunes Connect or make changes to TestFlight Beta Testing. You can schedule an app release or price changes to take place between December 22 and December 29. Just make sure that your changes are scheduled, submitted, and approved by December 18, to ensure your app remains available during this busy period.
|
# ? Dec 16, 2014 01:27 |
|
fleshweasel posted:Check your constraints. I tried adding the suggested constraints, and now when I run it, the simulator squeezes the last button on the right to make it fit. Is there any way to just make the view be the right size instead of having to adjust it until the simulator doesn't do that? Thank you for your help.
|
# ? Dec 16, 2014 01:30 |
|
So I take it that the cards are individual views? They should probably be constrained to have equal widths and heights. Although I'm not familiar enough with complex constraints to be sure what's best for a large set of identical elements like that. edit: it may work well to constrain them to have equal widths and constrain them to have a particular aspect ratio.
|
# ? Dec 16, 2014 01:52 |
|
Danyull posted:I tried adding the suggested constraints Just-In-Timeberlake posted:Any idea what the problem might be? You can try using GCD instead of performSelectorOnMainThread code:
dc3k fucked around with this message at 05:16 on Dec 16, 2014 |
# ? Dec 16, 2014 05:06 |
|
I'm looking into how to create an iPad version of my app. Right now I have a tab controller at the root of my iPhone storyboard. What I think I want for the iPad version is a split view controller that has 3 of the tabs of the tab controller as the master view controller, and the last tab of the tab controller as the detail view. Do size classes allow you to change the layout and/or initial view controller of the storyboard, or are you limited to just changing the presence and values of views inside view controllers? The iPhone should remain totally tab bar-based. The detail view's state doesn't particularly depend on what you do in the master view: they are generally just complementary to each other. Is there another technique I should be using? Should I look at maintaining separate iPad and iPhone storyboards? The lazy alternative, I guess, is to just have a giant version of the iPhone app. I would feel bad about that though. Does Apple outright reject those?
|
# ? Dec 16, 2014 06:38 |
|
fleshweasel posted:I'm looking into how to create an iPad version of my app. Right now I have a tab controller at the root of my iPhone storyboard. Screenshots would help suggestions more than any description. Mind providing one?
|
# ? Dec 16, 2014 06:48 |
|
Here's a proof of concept I have. Very sloppy at the moment. During the day there would be actual arrival times. When you select a bus stop, the table of routes comes up. The favorites view is always on the left. Not sure if it's any good considering the routes table is so stretched, but most bus stops have between 2-4 routes so it's not great to make it a column. The iPhone version is simpler and just has the map view here as another tab in the tab controller.
|
# ? Dec 16, 2014 07:12 |
|
Hmm. As a longtime iPad and iPad mini user, most people on the go are going to use it in portrait mode on a mini, though on the bigger models, landscape might be more common depending on the cover. The layout isn't a bad start, though that's not to exclude the possibility of something better. As for how you organize your storyboards - I don't know, because I kill them whenever possible. Apple's APIs are typically pretty awesome to consume from code so it baffles me just how quickly they've managed to make Interface Builder total poo poo. Nothing lasts forever, I guess.
|
# ? Dec 16, 2014 07:51 |
|
status posted:
Just tried it, no dice. Here is a video of what I'm talking about, you can see where the table's UIScrollViewDelegate gets called when I click the "+Add Vehicle" button and loads the table just before the segue fires. https://www.youtube.com/watch?v=7AR8HoVa8xg
|
# ? Dec 16, 2014 15:14 |
|
You should still be using dispatch_async() instead of performSelectorOnMainThread. Try it without the MBProgressHUD stuff.
|
# ? Dec 16, 2014 16:13 |
|
Doc Block posted:You should still be using dispatch_async() instead of performSelectorOnMainThread. Why?
|
# ? Dec 16, 2014 16:19 |
|
Doc Block posted:You should still be using dispatch_async() instead of performSelectorOnMainThread. No such luck
|
# ? Dec 16, 2014 17:55 |
|
Just-In-Timeberlake posted:Just tried it, no dice. Here is a video of what I'm talking about, you can see where the table's UIScrollViewDelegate gets called when I click the "+Add Vehicle" button and loads the table just before the segue fires. What UIScrollViewDelegate method is being called? pokeyman posted:Why?
|
# ? Dec 17, 2014 01:45 |
|
pokeyman posted:Why? status posted:GCD is much better at managing threads than you are. Just give it a task and let the system figure it out - that's why it exists. Neat article here!. Another obvious plus in the case of performSelectorOnMainThread is that you don't have to have a method with a single parameter and wrap all your objects up into one bullshit object and unwrap it later. You can have normal method names that take as many parameters as you want. Pretty much what status wrote. Don't worry about threads, just GCD queueueueueueues. Plus it's nice not having to needlessly break something out into a separate method that I would otherwise keep inline just so I can call -performSelectorOnMainThread:.
|
# ? Dec 17, 2014 03:10 |
|
Just-In-Timeberlake posted:No such luck This kind of thing reeks of doing UI stuff off the main queue, but that's just a hunch.
|
# ? Dec 17, 2014 03:13 |
|
Doc Block posted:Pretty much what status wrote. Don't worry about threads, just GCD queueueueueueues. Plus it's nice not having to needlessly break something out into a separate method that I would otherwise keep inline just so I can call -performSelectorOnMainThread:. I'm with you both on the general points here. I was interested in the specific question: why is dispatch_async(dispatch_get_main_queue(), ^{ [self doIt]; }) better than [self performSelectorOnMainThread:@selector(doIt)]? They look pretty similar to me. If it's just an overall "prefer GCD to performSelector/NSThread" that's cool. I thought maybe I was missing something.
|
# ? Dec 17, 2014 07:12 |
|
In this case, thisObjective-C code:
Objective-C code:
|
# ? Dec 17, 2014 08:33 |
|
Just-in-Timberlake: the part where you say -setupView works when called from -viewDidLoad but not "asynchronously" makes me think your issue is that you've missed something re: only doing UI stuff on the main queue. Instead of writing -setupView to work from any queue or thread, go through and make sure any calls to -setupView only happen on the main queue by wrapping them with dispatch_async(). Then put something like:Objective-C code:
Or you could even do it like Objective-C code:
Doc Block fucked around with this message at 08:56 on Dec 17, 2014 |
# ? Dec 17, 2014 08:46 |
|
Also, when you're downloading data asynchronously, Apple doesn't guarantee your completion block will be called on the main queue IIRC, so unless you're using a library that does guarantee it, wrap anything inside your download completion block that needs to happen on the main queue (such as all UI stuff) in dispatch_async().
|
# ? Dec 17, 2014 08:51 |
|
pokeyman posted:I'm with you both on the general points here. I was interested in the specific question: why is dispatch_async(dispatch_get_main_queue(), ^{ [self doIt]; }) better than [self performSelectorOnMainThread:@selector(doIt)]? They look pretty similar to me. It's a scheduling issue. -performSelectorOnMainThread basically creates a timer with 0 duration in NSDefaultRunLoopMode. If the user is, say, scrolling at the time, then UI changes aren't going to take effect. The CGD queue is basically more likely to fire sooner. You basically get the same effect if you go all the way to -performSelectorOnMainThread:withObject:waitUntilDone:modes: and choose NSRunLoopCommonModes.
|
# ? Dec 17, 2014 11:16 |
|
pokeyman posted:I'm with you both on the general points here. I was interested in the specific question: why is dispatch_async(dispatch_get_main_queue(), ^{ [self doIt]; }) better than [self performSelectorOnMainThread:@selector(doIt)]? They look pretty similar to me. Paging rjmccall - I think he's answered this before.
|
# ? Dec 17, 2014 11:17 |
|
ultramiraculous posted:It's a scheduling issue. -performSelectorOnMainThread basically creates a timer with 0 duration in NSDefaultRunLoopMode. If the user is, say, scrolling at the time, then UI changes aren't going to take effect. The CGD queue is basically more likely to fire sooner. That's a good point, I hadn't thought of that. Doctor w-rw-rw- posted:Is it ever a good idea to use 'performSelector*' methods? Aren't they bad for ARC or non-object parameters? Wouldn't surprise me if they suck, and you do need to silence compiler warnings to use them with ARC. I don't want to give anyone the wrong impression here, I'm not trying to mount a defense of the -performSelector... family of methods. It's more of a thought experiment and making sure I understand stuff.
|
# ? Dec 17, 2014 11:37 |
|
Doc Block posted:Just-in-Timberlake: the part where you say -setupView works when called from -viewDidLoad but not "asynchronously" makes me think your issue is that you've missed something re: only doing UI stuff on the main queue. Instead of writing -setupView to work from any queue or thread, go through and make sure any calls to -setupView only happen on the main queue by wrapping them with dispatch_async(). Then put something like: So I've done this, and as far as I can see all the UI stuff is being performed on the main thread but that initial show isn't happening Objective-C code:
Objective-C code:
|
# ? Dec 17, 2014 15:42 |
|
Ok, first of all, viewDidLoad will only ever be called on the main thread you don't need to wrap UI stuff that's in viewDidLoad with dispatch_async(). I meant put the NSThread stuff in setupView, and then only call setupView from the main thread. Why do you keep calling your table view a scroll view? Yes, UITableView inherits from UIScrollView, but they aren't the same thing. And a UIScrollView's delegate is very different than a UITableView's delegate or dataSource.
|
# ? Dec 17, 2014 16:52 |
|
Doctor w-rw-rw- posted:Is it ever a good idea to use 'performSelector*' methods? Aren't they bad for ARC or non-object parameters? It's a general rule (i.e. it's true even outside of ARC) that the method you call has to have a very specific signature involving just pointer types; as an additional promise, it's allowed to return void, but you have to be careful about that in ARC, because performSelector says it returns id, and if you accidentally do anything with that id, ARC's builtin paranoia about performSelector might evaporate and you'll end up "managing" a bunch of garbage bits. Also, as an extra rule in ARC, if the method you call does return an object, it had better return it at +0.
|
# ? Dec 17, 2014 18:45 |
|
Just-In-Timeberlake posted:
As an aside to your threading issues, dequeueReusableCellWithIdentifier:forIndexPath: will always return a valid cell. You don't need to test for nil. This code looks like you're following a fairly old tutorial. I would also use stringWithFormat: instead of creating an array and using componentsJoinedByString:
|
# ? Dec 17, 2014 18:58 |
|
Help! This is really weird and I'm not sure to what to do. My check for iOS version compatibility works in 2/3 of my targets: code:
I even do this before hand for my own sanity: code:
|
# ? Dec 18, 2014 23:28 |
|
I have dealt with that exact issue in swift. I wrote an obj-c static method just for that check and it worked without fuss.
|
# ? Dec 18, 2014 23:48 |
|
Found it! Changing the Optimization Level from 'Fastest [-O]' to 'None [-Onone]' allows the check to work properly. My Ad Hoc build was set to Fastest. Is this intended? What scares me is my Release config is also set to fastest, so would this not work on my app store submitted application?
|
# ? Dec 19, 2014 00:03 |
|
Your Release config should always be set to fastest or whatever. This is why you should always be sure to also test your app with Release config.
|
# ? Dec 19, 2014 03:26 |
|
We currently assume types always exist. It's a known limitation; we know we need better deployment-testing logic and are working in it. For now, don't disable optimization, just guard your version-specific code with an opaque check.
|
# ? Dec 19, 2014 10:14 |
|
What do you mean by an opaque check? Like checking the actual system version instead?
|
# ? Dec 19, 2014 16:07 |
|
Doh004 posted:What do you mean by an opaque check? Like checking the actual system version instead? That or what fleshweasel suggested, checking for the weak symbol in an ObjC function. It's not pretty, I know.
|
# ? Dec 19, 2014 21:09 |
|
Anyone feel like helping with this silly issue? Apparently, it's perfectly natural to expect ID3v1 tags to support internationalization. So my fork of Cog now has a filed issue, that it's not using the "system codepage" to decode the tags from the poster's Russian encoded tags, which are in the Windows codepage 1251 encoding. I can add a configuration option, assuming there's a handy way to detect supported encodings from the system and a handy way to convert 8 bit encodings to UTF-8, but I'm not exactly sure how to do either of those things, or for a better option, detecting the system locale and supporting that directly. The existing code just treats all of these unknown encoded tags as latin1.
|
# ? Dec 20, 2014 22:10 |
|
rjmccall posted:That or what fleshweasel suggested, checking for the weak symbol in an ObjC function. It's not pretty, I know. Oh okay, gotcha! Good to know and thanks for the clarification as always rjmccall.
|
# ? Dec 20, 2014 22:39 |
|
|
# ? May 17, 2024 15:57 |
|
kode54 posted:Anyone feel like helping with this silly issue? +[NSLocale currentLocale] might be helpful if you have a list of default fallbacks ("the current locale is Russia, let's use win-1251 as our fallback encoding"). As for converting between encodings, you want to get an NSString (e.g. via -[NSString initWithData:encoding:]) and then write it back out via -dataUsingEncoding:. The list of supported encodings is +[NSString availableStringEncodings]. Please let me know if this isn't helpful, I'm having a hard time gauging what level to answer at.
|
# ? Dec 21, 2014 16:10 |