|
Can somebody show me how to make an NSArray with random integers in it using arc4random()? Or explain what data type I should be using and give me some example code on how to make it? I tried code:
|
# ? Nov 28, 2011 00:08 |
|
|
# ? May 15, 2024 03:56 |
|
I believe you need to convert the NSInteger to an object:code:
|
# ? Nov 28, 2011 00:14 |
|
Every member of an array must be some kind of NSObject, which int is not and NSInteger also is not. Normal C arrays should work if you want to avoid NSArrays, but you can also wrap your numbers in NSNumber objects like.. int cInt = 324; NSInteger objCInt = 23444; NSArray * numArray = [[NSArray alloc] initWithObjects:[NSNumber numberWithInt:cInt], [NSNumber numberWithInteger:objCInt], nil];
|
# ? Nov 28, 2011 00:15 |
|
So I've made a French localized version of Localizable.strings, changed my iPad to French, and the French version of the strings doesn't pop up (it's still clearly using the English file). I've changed the file encoding to UTF-16, I tried adding a CFBundleLocalizations array to the Info.plist, neither kicked it into French. What am I missing? I've done this before. Edit: deleting the app from the iPad then reloading did it. Weird. lord funk fucked around with this message at 01:12 on Nov 28, 2011 |
# ? Nov 28, 2011 00:20 |
|
modig posted:Can somebody show me how to make an NSArray with random integers in it using arc4random()? Or explain what data type I should be using and give me some example code on how to make it? Objective-C is a strict superset of C, so anything that is valid C is also valid Objective-C.
|
# ? Nov 28, 2011 21:40 |
|
I need some cocos2d help, or maybe just some OpenGL help? This is just a mockup I whipped up in my photo editor. Let's say I want to load in an image like the one of the left but alter it at runtime to look like the one on the right. I know I need to do something along the lines of extending CCNode and overriding the draw method, but beyond that I'm totally lost. Any suggestions?
|
# ? Nov 29, 2011 06:03 |
|
Unless Cocos2D has some sort of trapezoidal deformation you can apply to sprites, you're in OpenGL ES territory. Conceptually it's very easy: you assign the texture coordinates as if the polygons were going to be drawn as a straight-on square like on the left, but when you actually draw them the actual shape of all the polygons is the thing on the right. Implementing it within Cocos2D probably wouldn't be too hard, if you already know OpenGL ES 1.1. Cocos2D handles pretty much everything for you with regards to setting up the OpenGL context and all that; you just have to render the polygons (and assign texture coordinates, etc.). edit: just remember that when Cocos2D switches to OpenGL ES 2.0 you'll most likely have to rewrite your custom drawing code.
|
# ? Nov 29, 2011 06:53 |
|
Speaking of OpenGL, I'm trying to programmatically take a screenshot of my EAGLView, so I found this post over in the dev center about how to do that. I dropped the call to the screenshot function before presentFramebuffer, but the PNG file delivered is completely blank. It's the right size - but it's empty.code:
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _colorRenderbuffer); to glBindRenderbuffer(GL_RENDERBUFFER, _colorRenderbuffer);. Why would my image be blank?
|
# ? Nov 29, 2011 17:47 |
|
I thought this might do it: changing kCGImageAlphaPremultipliedLast to kCGImageAlphaNoneSkipLast, since my layer is opaque, but now I get a completely black image.code:
|
# ? Nov 29, 2011 18:08 |
|
Here is the entire EAGLView.m if it helps.
lord funk fucked around with this message at 21:24 on Nov 29, 2011 |
# ? Nov 29, 2011 21:21 |
|
I've been shocked at the terrible performance of animated CALayers in OSX for 2d stuff. I was told they basically act as abstracted OpenGL objects, but the stuttering I'm seeing moving any image larger than 500x500 or so seems to indicate otherwise. Am I going to have to use OpenGL? edit: I realized a few of the large images in question have some non-0 and non-1 alpha going on all over the place that may be responsible for destroying performance. Time to spend some time messing around with that. ManicJason fucked around with this message at 21:45 on Dec 2, 2011 |
# ? Dec 2, 2011 21:15 |
|
In Cocos2D, I seem to have an issue with setting a sprites visibility to YES and NOT seeing the results immediately after a method call that hangs everything for a bit. It seems as though a frame draw has to occur, but this doesn't happen because the method call stops everything for a bit which makes it very noticeable. (There is no sprite in sight even though there should be) Does anyone know how to force a frame draw in Cocos2D? I think this my problem. Calling update (my CCScheduler method) would probably just cause an infinite loop, and maybe there's some way I could circumvent this, but it's just going to get messy. I've also tried making the visibility YES right before the method is called, but that does not make it show up either. LP0 ON FIRE fucked around with this message at 22:37 on Dec 2, 2011 |
# ? Dec 2, 2011 22:24 |
|
Taking away the alpha made very little difference. A coworker suggested an issue with the images being too large for the OpenGL buffer, but there's very little way to investigate that using CALayers, as far as I can tell. Here's what instruments has to say:
|
# ? Dec 2, 2011 22:50 |
|
Why didn't anyone tell me CodeRunner is so awesome?! Maybe it was mentioned and I missed it. Regardless, I was dreading my girlfriend taking a C++ class next quarter since they'll certainly teach in Visual Studio Express and she's most likely going to be using Xcode which is a bit overkill for a basic C++ class. I could set up Parallels or Boot Camp, but that's far more effort than I wanted to invest and not very seamless for her. However, CodeRunner looks to have a perfectly minimal interface that won't overwhelm her with buttons and options that she doesn't need (Xcode). It looks perfect for basic programming. Just an editing pane and an output console, supports Lion full screen and versioning. It's perfect. Star War Sex Parrot fucked around with this message at 23:58 on Dec 2, 2011 |
# ? Dec 2, 2011 23:36 |
|
ManicJason posted:Taking away the alpha made very little difference. http://lmgtfy.com/?q=png_read_filter_row
|
# ? Dec 2, 2011 23:42 |
|
ManicJason posted:Taking away the alpha made very little difference. A 500x500 image isn't going to be bigger than your GPU's max texture size (which is going to be at least 4096x4096, probably more like 8192x8192). Having alpha transparency shouldn't matter either. There's something else going on. edit: Zhentar posted:http://lmgtfy.com/?q=png_read_filter_row Weird, I would think that the image would be uncompressed when you passed it in and would then be transformed into whatever format was most optimal for the hardware. Doc Block fucked around with this message at 23:47 on Dec 2, 2011 |
# ? Dec 2, 2011 23:44 |
|
Zhentar posted:http://lmgtfy.com/?q=png_read_filter_row That would help me if I was coding for iOS. If you know of a OSX equivalent, feel free to answer instead of being a dick!
|
# ? Dec 3, 2011 02:10 |
|
I was finally able to get the PNGs loaded in an uncompressed format by using CGContextDrawImage() and then creating a new CGImage from the context. It had little if any positive effect and increased loading times a ton. It seems that compression isn't my issue. I think I'm the right track though when I noticed just how much transparency is going on. I have a few transparent layers on top of each other in the background. I'm going to spend some time consolidating them if they don't need to be dynamic, and I'm considering using [CALayer renderInContext:] to obtain a screenshot, pasting that over the entire screen, and animating my temporary effects over that.
|
# ? Dec 3, 2011 07:44 |
|
I know you can force a language at start up, but I can't find anything about changing the language on the fly-- anything that actually works, that is. Any ideas? better question: should I lose the idea of setting the language inside the app? It seems like using the defined language is the way to go, but I want to make sure the user knows they can switch. klem_johansen fucked around with this message at 06:07 on Dec 6, 2011 |
# ? Dec 6, 2011 05:57 |
|
I'll throw the standard "in general, don't do that" at you and suggest you, at most, point out that the user can change their language and locale settings in the Settings app. That generally useless advice aside, what I'd do is localize your app like normal. Then, if you want to change the interface language just for your app, you can ask an NSBundle (e.g. your app bundle) what localizations it supports. When the user changes the app's language, you could manually load strings files and update the interface. (You'll probably have to hardcode the paths to the localized strings files, as I don't think NS/CF-Bundle will help you.) Not speaking from experience, but I'm guessing your life will be made much easier if you avoid localizing nibs and simply make tables of strings. Then, on nib loading (or whenever), you can replace all the labels and such in your nib with whatever from the strings file. e: This is probably quite a bit of work, and I'm assuming here that you have a compelling reason for your app's interface to be in a language different from the OS and every other app. pokeyman fucked around with this message at 07:19 on Dec 6, 2011 |
# ? Dec 6, 2011 07:13 |
|
Yeah its not that hard to cook up your own solution with string replacing. Just create a function like , I dunno TR(@"String") and have it so it does a look up of the string and replaces it as needed. Keep the function name short as possible to minimize RSI or "brain RSI"
|
# ? Dec 6, 2011 09:57 |
|
pokeyman posted:
It's a kids' pop-up book, our third such app. The client wants people to be able to choose the language. I think I'll homebrew a localization set that defaults to the device's language setting.
|
# ? Dec 6, 2011 14:01 |
|
Does anyone have any links to resources on iOS UI design, besides the official HIG? I'm at the point where I have a couple apps that need attractive and intuitive UI before I release them, and I want to get some best practices/tips/examples with commentary, etc.
|
# ? Dec 8, 2011 18:23 |
|
Trying to wrap my head around IKImageBrowserView in conjunction with a foreground CALayer. Say I have a series of images in the browser via a Core Data model. These images will get various properties added to them via the UI. The properties will then be shown on top of the images themselves (via the CALayer) as the user scrolls around, following the images & keeping zoom etc in mind. Also clicking on the shown properties will produce some action. Any resources that would help with that? I haven't done any Core Animation before. Carthag Tuek fucked around with this message at 22:08 on Dec 8, 2011 |
# ? Dec 8, 2011 21:50 |
|
Malloreon posted:Does anyone have any links to resources on iOS UI design, besides the official HIG? A sense of curiosity while browsing the App Store can take you a long long way.
|
# ? Dec 9, 2011 01:29 |
|
My two friends and I developed a game for Android that ended up being relatively popular and got featured on the Android Market and was used as Amazon's Free App of the Day, and have been working on an iOS port for the last couple months. It finally got approved today and now we have a bit of contention between us on starting price points and wanted to get some outside opinion. One member of our studio really wants to start at .99 in order to increase initial ranking and exposure, while I'm of the mindset that starting at 1.99 is smarter overall because it gives us more flexibility to play with the price and that the difference between number of sales at both points will be negligible. I tried a quick google search to see if anybody had written about this topic and didn't come up with anything so I figured I'd ask here to see what you guys felt and what your experiences were with deciding starting pricing. E: I figure I should probably say what our game is. Im not sure if it's live yet on the app store but it is a color based puzzle game a-la Trainyard called 'Refraction' and is based on manipulating colored lasers with mirrors and prisms. lmao zebong fucked around with this message at 22:03 on Dec 9, 2011 |
# ? Dec 9, 2011 21:58 |
|
Seems to me most people will buy anything at .99 without hesitation, but will think twice if it's 1.99 - there appears to be an impulse gap there, at least in my circle. Don't have any numbers of course, so not sure the difference would make up to be twice the sales at the lower price point.
|
# ? Dec 10, 2011 00:50 |
|
Yeah honestly if you want maximum exposure, make it free for a week and then start charging.
|
# ? Dec 10, 2011 05:16 |
|
I'm about to finish my next app (feels strange to say it), and I can't remember: does the project name matter anymore? I have a bundle display name set, and I think you give the App Store name when you create the app in iTunes Connect. Does the Xcode project name matter? Edit: I guess it doesn't. lord funk fucked around with this message at 21:06 on Dec 10, 2011 |
# ? Dec 10, 2011 19:35 |
|
It matters about as much as the filename, which is to say not at all.
|
# ? Dec 10, 2011 21:49 |
|
Can I move or resize an NSButton while my app is running? I was going to make a tab system and was going to just use NSButtons, but it looks like I'm going to have to make my own.
|
# ? Dec 11, 2011 01:59 |
|
Yes? Just set its frame.
|
# ? Dec 11, 2011 02:34 |
|
So I just upgraded to Lion and I didn't realize that doing so would disable my installed version of Xcode. Since the app store won't let me update it (says my copy of OSX is too new) how do I do this right? Just download the free version of 4.2.1 from the store and install it? Will that overwrite my current install or do I have to uninstall my current version of Xcode somehow? The official documents say I'm supposed to run an upgrade tool through Xcode itself but I can't even launch the application to do so.
|
# ? Dec 11, 2011 03:34 |
|
Grab any old SDKs you need from /Developer, then yeah, grab the free Xcode 4 from the App Store. Toss any old SDKs back where they came from. Note that I've never bothered keeping old SDKs around so those instructions might be a bit off.
|
# ? Dec 11, 2011 04:16 |
|
Yeah it looks like the new version I downloaded from the app store was actually some kind of installer instead of installing straight from the app store like the first iteration of Xcode 4. Man all that poo poo makes me nervous. After the first time my computer got wiped, watching Lion take 10 hours to download and install + updates and Xcode I was really worried.
|
# ? Dec 11, 2011 04:50 |
|
pokeyman posted:Yes? Just set its frame. Derp. That was simple. Didn't see it on the NSButton reference and haven't worked with views enough to realize it would inherit that method.
|
# ? Dec 11, 2011 05:19 |
|
Yodzilla posted:Yeah it looks like the new version I downloaded from the app store was actually some kind of installer instead of installing straight from the app store like the first iteration of Xcode 4..
|
# ? Dec 11, 2011 05:52 |
|
^^ ah gotcha Did the newer version of Xcode change a lot of basic things like the way TextViews and ScrollViews are rendered? I just opened a project from July and noticed some xib files were really screwy looking. Elements were resized and moved around but even stranger the TextViews no longer acknowledge line breaks. It's keeping ones that are already there but if I remove a line break and then try to add it back in using the visual editor by pressing control+enter it's not reflected in the view. The line breaks are being saved in the raw data but for some reason aren't represented visually. Scroll views seem to now be cutting off the bottom of many pages as well. Very odd. I didn't convert the project to be base iOS version 5 for fear of things like this but I guess just updating Xcode was enough to mess little things up.
|
# ? Dec 11, 2011 06:04 |
|
Star War Sex Parrot posted:Why didn't anyone tell me CodeRunner is so awesome?! This is pretty cool. Worth five bucks to me, anyway. I just wish it supported command line arguments and multiple files - at least the multiple files might bite someone who was taking a C++ class since submitted homework would probably want to have the headers and implementation separate. At that point it might just become an underpowered IDE, though...
|
# ? Dec 11, 2011 19:12 |
|
|
# ? May 15, 2024 03:56 |
|
When adding a new subview with a page curl: [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES] in landscape mode, I have the issue where the curls look weird when the device is upside down. I tried alternative between curlUp & curlDown based on orientation, but it still doesn't look right. I know i can set a container frame to flip everything in a block animation, but it doesn't seem to work in this form. It seems like there must be a simpler way. Is there?
|
# ? Dec 11, 2011 21:55 |