|
gooby on rails posted:How much does the layout or set of fields in each view vary? If they answer is "little to none", you could create a xib file template and load it repeatedly to instantiate several copies of it. I heard about this from someone in IRC, and it sounds awesome, but I can't find any tutorials on how to load an XIB like that. I'm probably just not googling for the right stuff, but if you could point me in the right direction, I'd appreciate it
|
# ? Aug 7, 2012 00:56 |
|
|
# ? Jun 5, 2024 07:41 |
|
abraham linksys posted:I heard about this from someone in IRC, and it sounds awesome, but I can't find any tutorials on how to load an XIB like that. I'm probably just not googling for the right stuff, but if you could point me in the right direction, I'd appreciate it Just create a new view controller and check the box that says create a XIB file, then use drag/drop to create the UI in the Interface Builder pane in Xcode. Then click on split view and control-drag from the controls in the IB pane to your controller's .h file in the right-hand pane and it will prompt you to create outlets (properties that reference the UI controls) and actions (event handler methods). Then in your controller's code you can fill in the fields with appropriate data in viewDidLoad. Feel free to stick controls on there that are only used in some cases and set them to hidden=YES when not in use. Honestly, check out the CS193P lecture on iTunes U... It's been updated for Xcode 4, ARC, etc. He goes over how to do all this with a demo and everything. It can be hard to do a good google search because a lot of stuff still talks about the old way when Interface Builder was a separate application. Unrelated note: anyone around here know of a reasonable tech writer or copy writer? I want to get some help updating my app's store description and website and I just don't have the time these days. I was able to get the website looking a hell of a lot better (https://www.obsolete-software.com) but it still needs work.
|
# ? Aug 7, 2012 01:04 |
|
is there any reason to use an xib instead of a storyboard?
|
# ? Aug 7, 2012 01:05 |
|
Ender.uNF posted:Just create a new view controller and check the box that says create a XIB file, then use drag/drop to create the UI in the Interface Builder pane in Xcode. Then click on split view and control-drag from the controls in the IB pane to your controller's .h file in the right-hand pane and it will prompt you to create outlets (properties that reference the UI controls) and actions (event handler methods). Then in your controller's code you can fill in the fields with appropriate data in viewDidLoad. Feel free to stick controls on there that are only used in some cases and set them to hidden=YES when not in use. In addition to all this, after you have a view set up in a xib you can call code:
|
# ? Aug 7, 2012 05:53 |
|
I have a workflow for an iOS application at the request of a client that works like a state machine. When an event is fired, the person is brought through a series of screens that work in a forward-only manner, the user cannot ever go back. Often times, there are series of screens that are looped over and over again. Currently, I have a state machine that drives a view controller telling it what current screen it should be using, and it's consistently replacing a subview from a collection of other views. Is this basically the only way to approach this? It makes everything extremely kludgey and to be honest I'm embarrassed by the way the code looks because it seems so damned sloppy, but I can't honestly think of a better way to do it on iOS. Using a UINavigationController seems to not really work for what I need to do because the flow doesn't make sense to be constantly pushing view controllers onto a stack, since the looping nature of some of the screens.
|
# ? Aug 7, 2012 16:43 |
|
UINavigationController is what I'd use. You can pop its stack back to an arbitrary point, or replace it altogether, anytime you need. So when it's time to loop back from screen 5 to screen 2, just pop the stack. If you don't want to use a navigation controller, I'd make my own containing view controller that did exactly what I want.
|
# ? Aug 7, 2012 18:52 |
|
If I set the delegate of my NSApplication in my MainMenu.xib, at what point does that take effect? I'm getting unrecognized selector exceptions because sometimes the delegate is NSDocumentController instead of my custom class. And when I send an add: message to my NSArrayController, I get an exception about trying to add a nil object to an array, I think. Isn't it supposed to create the object, then add it to the content arrary?
|
# ? Aug 8, 2012 05:47 |
|
zergstain posted:If I set the delegate of my NSApplication in my MainMenu.xib, at what point does that take effect? I'm getting unrecognized selector exceptions because sometimes the delegate is NSDocumentController instead of my custom class. Very quickly, so check MainMenu.xib (File Owner's delegate outlet should be connected to an instance of your custom class) and make sure you're not sending -[NSApplication setDelegate:] anywhere (set a breakpoint maybe). That said I'm curious: what are the unrecognized selectors and when do they get called? Seems odd that NSDocumentController is getting hit. quote:And when I send an add: message to my NSArrayController, I get an exception about trying to add a nil object to an array, I think. Isn't it supposed to create the object, then add it to the content arrary? What's the exception? If you set the controller's content to an immutable NSArray (you want NSMutableArray) that could explain -add: failing. (You're correct about what -add: should be doing.)
|
# ? Aug 8, 2012 06:06 |
|
I notice Clang is now auto-generating variables for @properties. It's generating errors in projects I've ported from Xcode 4.3, and frankly, I don't want it to do this. How do I turn this off?
|
# ? Aug 8, 2012 07:13 |
|
There may be a compiler flag or something that I'm sure someone else will know, but if you manually implement both the getter and setter for a property, the ivar will not be automatically generated. You can also manually declare the ivar if you want. It's a great feature though, and I'm having a hard time imagining a scenario where you have a property you don't want an ivar for but you also don't want to implement the getter and setter yourself.
|
# ? Aug 8, 2012 07:30 |
|
pokeyman posted:Very quickly, so check MainMenu.xib (File Owner's delegate outlet should be connected to an instance of your custom class) and make sure you're not sending -[NSApplication setDelegate:] anywhere (set a breakpoint maybe). code:
quote:What's the exception? If you set the controller's content to an immutable NSArray (you want NSMutableArray) that could explain -add: failing. (You're correct about what -add: should be doing.) code:
I think I might've just figured out my second problem, I thought @properties were initialized for some reason. Now it's telling me I need to implement copyWithZone: is that normal, or is some option turned on that shouldn't be or something? zergstain fucked around with this message at 15:28 on Aug 8, 2012 |
# ? Aug 8, 2012 15:26 |
|
Small White Dragon posted:I notice Clang is now auto-generating variables for @properties. It's generating errors in projects I've ported from Xcode 4.3, and frankly, I don't want it to do this. How do I turn this off? Try -fno-objc-default-synthesize-properties (List of compiler flags: clang -cc1 --help)
|
# ? Aug 8, 2012 17:22 |
|
zergstain posted:
Is your application delegate's class properly set in MainMenu.xib in the Identity inspector? Maybe add an exception breakpoint and see what's at 0x10051fd00 (or the equivalent in the exception that gets thrown)?
|
# ? Aug 8, 2012 17:25 |
|
pokeyman posted:Is your application delegate's class properly set in MainMenu.xib in the Identity inspector? I've been pausing when the exception dialog comes up and printing the object at that address. It's an NSDocumentController when I get the exception. It seems completely random if the right delegate is set, and I do have the class set properly in my MainMenu.xib. I've got a breakpoint at my Document class's windowDidBecomeMain: and I've been doing "po [NSApp delegate]". Sometimes it's the right class. I just changed the superclass to NSObject from NSDocumentController, and now that problem has gone away. I may actually need to override methods in NSDocumentController in the future, not sure at this point. Wish I knew what was up.
|
# ? Aug 8, 2012 18:48 |
|
Small White Dragon posted:I notice Clang is now auto-generating variables for @properties. It's generating errors in projects I've ported from Xcode 4.3, and frankly, I don't want it to do this. How do I turn this off? The best way is always to declare what you're doing, e.g. by using @dynamic, instead of fighting the language direction. But I'm curious to know what errors you're seeing and why you don't want autosynthesis.
|
# ? Aug 8, 2012 22:10 |
|
If I want to have logic like forcing there to be at least one item in my NSArrayController's content array, do I need to subclass the controller?
|
# ? Aug 9, 2012 04:02 |
|
TextMate 2 is now open source. GPLv3 license. I mention it here as it's a fairly large OS X app, so there might be some valuable insights to be gained. Or maybe one of you will turn it into a functioning product!
|
# ? Aug 9, 2012 17:30 |
|
I took a look, and it appears as if the core is in C++ with an Objective-C GUI, as if the goal was eventually to go cross-platform.
|
# ? Aug 10, 2012 07:43 |
|
I'm trying to set up a series of methods to download a series of files from a server and save them locally to the iOS device for use elsewhere in the app. In order to do so I thought it would be best to set up a function that takes in the name of a file to download which then calls a NSURLConnection. The issue is that I'd like that connection's didFinishLoading method to be able to access a variable for the purposes of naming the file that it has just downloaded. I found this answer on StackOverflow but for some reason it doesn't work with my code. I've pasted the header and class files for the view that I'm trying to accomplish this in below:code:
code:
|
# ? Aug 10, 2012 14:52 |
|
Yodzilla posted:... It seems to me that the SO article is setting a variable to the "self" object and then passing "self" as the delegate, so then the didFinishLoading method is just doing something to the variable owned by that delegate. It doesn't seem to be setting a variable to the connection object itself.
|
# ? Aug 10, 2012 15:05 |
|
Oh so that example wouldn't work with synchronous downloads anyway. I guess I could always just hold up the next download until the previous one finished and keep the file name in a global variable.
|
# ? Aug 10, 2012 15:11 |
|
I'm really new to objc and programming in general, and I've been having a lot of memory issues. I started including log messages (ie NSLog(@"dealloc %@",self) in the dealloc methods of the classes I'm struggling with. This has really helped me figure out where I was going wrong with memory management. Is there a more direct way of finding out whether or not a release resulted in a dealloc? Is there any reason I shouldn't be doing this? Similarly, is there be anything wrong with overriding retain like so: code:
These methods are just for educational purposes, of course.
|
# ? Aug 10, 2012 16:03 |
|
Is there a particular reason you want to use retain/release instead of ARC?
|
# ? Aug 10, 2012 16:37 |
|
chumpchous posted:I'm really new to objc and programming in general, and I've been having a lot of memory issues. I started including log messages (ie NSLog(@"dealloc %@",self) I strongly suggest using ARC instead of manually adding retain/release calls. It's recommended for basically everybody, but particularly for people new to Objective-C. That said, that's a perfectly reasonable logging override of retain, but a much better alternative is to get comfortable with using the Leaks instrument. Despite its name, Leaks is a generic tool for logging the history of allocations, retains, and releases, and it even captures a stack trace at each event.
|
# ? Aug 10, 2012 17:42 |
|
I'll second Leaks and NSZombie which automatically does what you were trying to do... It tells you when you touch a dead object and shows you where it got created and destroyed. The past two WWDCs have had good videos on this subject.
|
# ? Aug 10, 2012 18:18 |
|
Toady posted:I took a look, and it appears as if the core is in C++ with an Objective-C GUI, as if the goal was eventually to go cross-platform. If that was a goal, it sounds a lot harder than making an OS X-only editor. I think I'd be more interested in the code for TextMate 1. Starting from a working product sounds much more fruitful than dumping a half-finished one on the masses.
|
# ? Aug 10, 2012 19:33 |
|
I'm looking at making an iOS app focused on sine wave generation and synthesis. Does the iOS Audio Unit API have a tone generator function I'm not seeing in the reference manual? The Mac OS version does. Am I going to have to use a sample of a sine wave instead?
|
# ? Aug 10, 2012 22:37 |
|
My Google-fu is failing me.... I have something like this: code:
What I want is sort of the "inverse" of this, which the predicate guide says 'NONE' is for, but...: code:
Lumpy fucked around with this message at 02:42 on Aug 12, 2012 |
# ? Aug 12, 2012 02:40 |
|
So I've got a bit of a best practices question. I've created a view that contains a paged scrollView that can contain an arbitrary number of items of different formats and heights. In order to do this the parent paged scrollView is locked at a certain height and contains sub-scrollViews of fixed width and variable height. This allows you to page through the items by swiping left and right and scrolling each item by swiping up and down. This all works great. Now each item can be either an image, a PDF, a Keynote file, a Powerpoint file, a video, or whatever else. All of these are also working great save for the videos which is where I'm looking for some guidance. The biggest issue is that there are multiple ways of showing videos within a view in iOS. My requirements are that: - i need to be able to control the video so that it is paused automatically when swiped out of view - it can't play automatically - controls need to be displayed by default - and a bit optional, we'd like to show a still image preview before the user clicks play Here are the solutions I've tried along with the pros and cons of each:
What I haven't tried is actually building out an HTML5 player in HTML and adding that to the webView. I assume that if I do this I'd be able to have it not play by default and have a preview image but is there any way to hook back into that webView and pause the video? Let me know if anything needs clarification.
|
# ? Aug 12, 2012 16:43 |
|
Anyone interested in the cross-platform benefits of Unity while still wanting to develop 2d games primarily in code (not the 3d editor thingy) should check out http://struct.ca/futile
|
# ? Aug 12, 2012 16:44 |
|
Yodzilla posted:So I've got a bit of a best practices question. I've created a view that contains a paged scrollView that can contain an arbitrary number of items of different formats and heights. In order to do this the parent paged scrollView is locked at a certain height and contains sub-scrollViews of fixed width and variable height. This allows you to page through the items by swiping left and right and scrolling each item by swiping up and down. This all works great. I used AVPlayer and AVPlayerLayer for a similar problem, it might be useful for you here.
|
# ? Aug 12, 2012 19:21 |
|
That's mainly for multiple video files right? The reason I avoided AVPlayer was that the presentation could be any file type in any order so I figured it would be a waste to have multiple instances of it on a page instead of one instance containing multiple videos. I guess I can give that a shot though.
|
# ? Aug 12, 2012 19:36 |
|
Yodzilla posted:That's mainly for multiple video files right? The reason I avoided AVPlayer was that the presentation could be any file type in any order so I figured it would be a waste to have multiple instances of it on a page instead of one instance containing multiple videos. I guess I can give that a shot though. AVPlayer is for one item, AVQueuePlayer is for multiple. I don't know how much of an issue it is to have multiple AVPlayer objects in terms of resources.
|
# ? Aug 13, 2012 00:05 |
|
I'll have an enterprise app going out the door in a couple months and I'm afraid I won't figure out a way to get rid of the notification center drop down on iOS 5.1.1. Anyone know any tricks? It will be in a case blocking the home button, so maybe the very top could be blocked off, but I would want to make it easier than that.
|
# ? Aug 13, 2012 23:35 |
|
LP0 ON FIRE posted:I'll have an enterprise app going out the door in a couple months and I'm afraid I won't figure out a way to get rid of the notification center drop down on iOS 5.1.1. Anyone know any tricks? It will be in a case blocking the home button, so maybe the very top could be blocked off, but I would want to make it easier than that. You might want to wait until iOS 6
|
# ? Aug 13, 2012 23:41 |
|
There's no public API for disabling the notification centre or its swipe gesture tab thinger in iOS 5. The most control you'll get is changing the status bar orientation, as that also controls where the notification center tab appears. There is a way to disable it on a jailbroken device. Not sure if there's a private API that your app can call (I'm guessing not).
|
# ? Aug 14, 2012 00:03 |
|
I can't wait for guided access. TC-11 performance is easily interrupted by accidental home button presses and notification center, and letting Apple get rid of them instead of me makes it that much better.
|
# ? Aug 14, 2012 00:36 |
|
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. The client thought it was genius.
|
# ? Aug 14, 2012 00:47 |
|
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.
|
# ? Aug 14, 2012 01:26 |
|
|
# ? Jun 5, 2024 07:41 |
|
Has anyone ever used this, or is it as crazy as it seems? http://www.andescotia.com/products/marten/
|
# ? Aug 14, 2012 01:33 |