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
pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Hibame posted:

At work I am working on a prototype application for the iPad and learning all the fun apple related stuff (xcode & objective-c) at the same time. I am trying to make heavy use of UITableView with lots of custom cells. I really want to use UITableView for user input much like the iOS settings views. Every example I have found to do this manually creates each cell with a big if else block inside cellForRowAtIndexPath. Is there a better way to go about this for larger input views?

I'm not sure what you mean by "larger input views". If you mean "having many items to input", have a look at something like QuickDialog, for inspiration if not for actual use. (I haven't actually used QuickDialog, I wrote my own piece of poo poo wheel-reinvention code like this each time because I'm dumb.)

If you mean something like "type lots of text into a multi-row text view", I'd consider not using a table view.

Adbot
ADBOT LOVES YOU

Hibame
Feb 20, 2008

pokeyman posted:

I'm not sure what you mean by "larger input views". If you mean "having many items to input", have a look at something like QuickDialog, for inspiration if not for actual use. (I haven't actually used QuickDialog, I wrote my own piece of poo poo wheel-reinvention code like this each time because I'm dumb.)

If you mean something like "type lots of text into a multi-row text view", I'd consider not using a table view.

QuickDialog looks like exactly what I need instead of rolling my own.

Is there a good central place to find resources like QuickDialog? I came across AFNetworking and JSONKit from google but I also knew some key words to look for. I don't think I would have come across QuickDialog looking for UITableView resources.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I originally found QuickDialog by searching for something like "iOS form table". I haven't found any good centralized sources for iOS libraries and controls (there are some but I don't like or use the ones I've found). I usually end up searching the web, github, and/or bitbucket.

e: I also find that people who write one useful bit of code tend to write multiple bits of code. Try browsing through the list of a github/bitbucket user's repos to see if they've made anything else interesting.

pokeyman fucked around with this message at 20:47 on Aug 2, 2012

duck monster
Dec 15, 2004

ManicJason posted:

Well, I made some progress finally. I couldn't su jenkins because the OSX Jenkins installer set its shell to null. I've never used dscl before, but I finally stumbled around enough to set its shell to bash, su jenkins, and then fix the git cloning issues.

I also managed to get some keychain issues sorted out, so that's good.

Now my problem is that our current setup has one repo for some shared network protocol and another repo for our actual iOS builds. Our builds don't work right if they two repos are not in sister directories.

It looks like there are quite a few ways around this, though none of them are great. I tried the multiple SCM plugin and had some path issues. I may try setting a different job for our shared network protocol repo and then linking each of our iOS jobs to it somehow or vice versa.

Progress at least!

I don't use SU ever on a mac. sudo -s works a charm, and keeps poo poo inside the sudo crib of cotton wool.

ManicJason
Oct 27, 2003

He doesn't really stop the puck, but he scares the hell out of the other team.
After another day or so of hunting down even more issues, I think I got my prototype Jenkins server (read: personal laptop) set up and working as a good proof of concept. I made a job for our common network protocol and had it do nothing but check out the latest and archive the relevant protocol files. I changed each iOS job to check out its relevant repo into a subdirectory instead of the root workspace directory. I then used the Copy Artifacts plugin to grab the latest from our networking job and put it in a sister directory of the iOS repo as expected before building each iOS job. I then set each iOS job to trigger on builds of the protocol job.

The end result is that any change to networking protocol will force a build of all iOS projects. Any change to an iOS project will obviously also cause them to build. The only problem is that I am going to have a clone of our iOS repo for every single project, and likely multiple of each of those to allow different job settings for different branch types. Also it is going to rebuild every iOS project if any one of them is changed. I may just run it as is for awhile and see if that needs tweaking.

Tomorrow I get to work on having Jenkins send the products up to our deployment server.

I will defeat this Jenkins demon.

Built 4 Cuban Linux
Jul 15, 2007

i own america
I already posted this question but I don't think I expressed it very well (or there is no good answer to it).

So here's an example. The green view controller on the right is great, and sometimes I want to programmatically load some new views into there. I want to design these views in IB and link them to properties so I can load them from my code [self.view addSubView:newView]; and so on.

.xibs are great because views can exist independent of a view controller so I can design them freely.

In a Storyboard, it seems like any view that can be accessed by a view controller must be designed within the 640x480 bounds of the view controller. This is kind of bullshit. Is it really like this?

I can design all my views in xibs and load them manually from there but:
a) its not as clean as doing it all in a storyboard
b) i lose cool features like table cell prototypes

Only registered members can see post attachments!

zergstain
Dec 15, 2005

I have an NSWindowController subclass with a nib, and a menu command which attaches the window as a sheet to the document window. After several hours of trying to figure out why it crashed when I clicked a button on the sheet, I figured out that ARC was releasing the controller before I was done with it.

Is there something I can do in my nib or something to tell it to retain a reference to the controller as long as the window is visible? Making file's owner the delegate doesn't seem to be the answer.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Typically the window controller would be the owner of its nib file.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
...in which case you'd need to keep a strong reference to the window controller until you're done with it (e.g. stick it in an instance variable). Setting it as the window's delegate won't help as NSWindow (like almost everything) won't retain its delegate.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Built 4 Cuban Linux posted:

storyboard and view controller blues

I wonder if there's a way to reorganize what you're trying to do such that you don't need to swap views around within a single view controller. Can you go into more detail about what you're trying to do? Maybe someone will have some fresh ideas.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

pokeyman posted:

...in which case you'd need to keep a strong reference to the window controller until you're done with it (e.g. stick it in an instance variable). Setting it as the window's delegate won't help as NSWindow (like almost everything) won't retain its delegate.

In a document app, any window controllers for the document are owned by the document. If you're making it yourself, you'll need to add it to the document yourself. AFAIK, that's just as true for sheets as for independent windows.

Built 4 Cuban Linux
Jul 15, 2007

i own america

pokeyman posted:

I wonder if there's a way to reorganize what you're trying to do such that you don't need to swap views around within a single view controller. Can you go into more detail about what you're trying to do? Maybe someone will have some fresh ideas.

I have ways to get around it, but I have a few tables I'm popping up for people to select stuff from and I don't want them to take up the entire screen and I'd rather have all the tables use the same data source and delegate, rather than duplicating code and having each in their own view controller.

I'm getting around it by making the views in separate xibs and just living without the dynamic prototypes for table cells. It's not really that much harder, it's just a little inconvenient and I'd consider a poor design decision by Apple (or maybe just an oversight).

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Built 4 Cuban Linux posted:

I already posted this question but I don't think I expressed it very well (or there is no good answer to it).

So here's an example. The green view controller on the right is great, and sometimes I want to programmatically load some new views into there. I want to design these views in IB and link them to properties so I can load them from my code [self.view addSubView:newView]; and so on.

.xibs are great because views can exist independent of a view controller so I can design them freely.

In a Storyboard, it seems like any view that can be accessed by a view controller must be designed within the 640x480 bounds of the view controller. This is kind of bullshit. Is it really like this?

I can design all my views in xibs and load them manually from there but:
a) its not as clean as doing it all in a storyboard
b) i lose cool features like table cell prototypes

Ummm why can't you just go to the View Controller for that view, then the Attributes tab, Simulated Metrics, Size = Freeform, then click on the View itself, Size tab, and adjust the view's size? (Note: I haven't tested it at runtime, just in Xcode)

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Athrok_01 posted:

How much should I expect to pay a developer an hour?

I'm using an access database through Glassdata right now, but I think it would serve better as a standalone app.

I think it's a simple project:

20 tables with one variable.

I'd like to be able to :
Chart the trend for each variable
Have a number pad pop up for entering each update
See the updates for the day on one form
Save files to upload files to a server for sharing between multiple users

How easily could this be done?


That's going to vary a lot depending on the experience of the developer, how fancy/bulletproof you want the app to be, length of contract, etc. Rates for iOS development range from peanut wages of 20/hr up to 150/hr or more for a specialist.

zergstain
Dec 15, 2005

If I call [aWindow setContentMaxSize:] and aWindow is already larger than the new maximum, how do I make it automatically snap to the new maximum size without manually resizing it? Is there a method, or will I have to manually check the size and adjust it if it's too large?

Built 4 Cuban Linux
Jul 15, 2007

i own america

Ender.uNF posted:

Ummm why can't you just go to the View Controller for that view, then the Attributes tab, Simulated Metrics, Size = Freeform, then click on the View itself, Size tab, and adjust the view's size? (Note: I haven't tested it at runtime, just in Xcode)

Because then the main view for that view controller will be gigantic.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice
Core Data question:

I have an abstract entity 'Foo'. I have, for sake of example, two other entities 'Bar' and 'Baz' that have Foo as their parent entity. Bar has a 'title' property, and 'Baz' has 'firstName' and 'lastName' properties.

In a magical, perfect world, I'd like to performa a fetch request with the entity description being 'Foo' and then some predicate along the lines of "title BEGINSWITH[c] %@ OR firstName BEGINSWITH[c] %@ OR lastName BEGINSWITH[c] %@", someString But since Foo does not have those properties, it obviously fails with a valueForUndefinedKey error.

Since I'm on iOS with a SQLite data store, I can't do a predicate with block on the fetch request, so the two kludgy solutions I've thought of are adding a 'searchName' property to Foo, and setting when I set the name of Bar and lastName of Baz, but then I lose searching by firstName, unless I add a searchName2 etc. and that's ugly. The other is to just get everything in the initial fetch request and filter that with a block predicate, but I'd like to avoid that for performance reasons.

Anyone solve this problem better than my initial stabs at it?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Have you actually run into performance problems, or are you assuming filtering one big fetch request will be slower? How many objects are we talking about?

Does this need to be a single fetch request? Why not do one for Bar matching title, another for Baz matching firstName or lastName, then iterate over both of them?

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
I just realized that return (whatever) stops evaluation of a method, just like break.

This explains almost every problem I've had over the last few days. I am an idiot.

Doc Block
Apr 15, 2003
Fun Shoe

chumpchous posted:

I just realized that return (whatever) stops evaluation of a method, just like break.

This explains almost every problem I've had over the last few days. I am an idiot.

Sort of. return exits the current function/method and returns to the calling function/method/whatever, always. break exits the current loop/switch/whatever.

So
code:

for(int i = 0; i< 10; i++) {
    if(i == 5)
        break;
}

// some more code down here

In this example the break statement just breaks you out of the for loop and the code after the loop will still execute, but replacing break with return will cause execution to return to the caller immediately.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

pokeyman posted:

Have you actually run into performance problems, or are you assuming filtering one big fetch request will be slower? How many objects are we talking about?

Does this need to be a single fetch request? Why not do one for Bar matching title, another for Baz matching firstName or lastName, then iterate over both of them?

The reality of the situation is that there are 5 different entities, and there will be thousands, possibly tens of thousands of them. I am probably prematurely optimizing; as that is one of my bad habits, and I implemented it as a 'fetch all and filter w/ block predicate' today, but haven't gotten to generating 1, 10, 100 thousands records to see how it performs versus doing 5 different ones and merging the results after. Thanks for that suggestion, by the way... for some reason that never occurred to me :D

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Lumpy posted:

The reality of the situation is that there are 5 different entities, and there will be thousands, possibly tens of thousands of them. I am probably prematurely optimizing; as that is one of my bad habits, and I implemented it as a 'fetch all and filter w/ block predicate' today, but haven't gotten to generating 1, 10, 100 thousands records to see how it performs versus doing 5 different ones and merging the results after. Thanks for that suggestion, by the way... for some reason that never occurred to me :D

You can't do what you are trying to do; it works by accident with certain store types (but not SQLite) because you can use entity.name and boolean short-circuiting to bypass the check for the non-existent property, eg: "(entity.name = BAZ && bazProp = 1) || (entity.name = FOO && fooProp = 2)". I believe Apple has issued a "do not do this, you fools!" warning on it but YMMV.

Honestly I've never encountered a situation where you would need to do this; usually if I am searching for a specific field it is either common to all the subclasses (why I setup subclasses in the first place) or it is unique to one subclass (so I already know to restrict my query to that type).

I would just put the common fields in the base class (unless it made no sense whatsoever), even if those common fields will be blank on certain subclasses most of the time. It makes things way simpler.

Alternately create the searchField1, searchField2 fields like you said, then create transient properties on the subclasses and implement the getters/setters on the transient property to redirect to the field on the base class. You have to make the correct willChange/didChange calls on the setters to make sure KVO works properly but otherwise it keeps things simple because the base entity manages the storage/lifetime/etc of the actual values. Trying to keep separate storage in sync is a nightmare you don't want and I've run into situations where not having a transient property (just manually sticking a property in the Obj-C file) causes issues with stuff complaining that the property doesn't exist or KVO notifications not working.

I usually name my "odd" fields like that with some kind of scheme (like z_ prefixes) so they stay out of my autocomplete lists and I don't accidentally use them... I use a similar scheme when I need to store crap that is perfectly serializable into NSData but not directly supported or where I want to store something like a CGRect but have the entity spit out an actual CGRect, not four separate NSNumbers that must have floatValue called then repacked into a CGRect manually. The transient property would just be "rect" and underneath it returns CGRectMake([z_width floatValue], ...);

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Ender.uNF posted:


// good stuff


Thanks for all that.

Just for an FYI to anyone who cares, I wrote a test app and starting at 1,000 records going up to ~35,000 doing multiple fetch requests and merging / sorting the results was twice as fast as one big fetch and filtering it. Both are fast though....


code:
total records was 35964

single fetch and filter results got 3996 results
test took 0.351054

multiple fetch and merge got 3996 results
test took 0.173736

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Lumpy posted:

Thanks for all that.

Just for an FYI to anyone who cares, I wrote a test app and starting at 1,000 records going up to ~35,000 doing multiple fetch requests and merging / sorting the results was twice as fast as one big fetch and filtering it. Both are fast though....


code:
total records was 35964

single fetch and filter results got 3996 results
test took 0.351054

multiple fetch and merge got 3996 results
test took 0.173736

I'm assuming you tested this on the device and not in the simulator.

xelfer
Nov 27, 2007

What's new, Buseycat? woa-aah, woa-aah, woa-aah
I'm wondering if something like this is possible using storyboards, or is my only option through code?

I have a UITabBarController with a UINavigation Controller/UITableView(1) embedded in it. This UITableView(1) then calls another UITableView(2):



I want to show UITableView(2) by default in the tab bar though, and still have the back Bar Button back to UITableView(1).

The visual representation I came up with is something like this:



But I'm guessing because the segue between 1 and 2 is manual, it won't really work. If I use a custom button, the push goes in the wrong direction.. and I'm really trying to do it similar to how the iPhone Mail app shows your email then provides the back button to your Mailbox list.. except within a tab view.

any ideas?

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:
Does anyone have any experience with air play on their own device? In that i mean on a non apple tv connected device. I have a prototype being produced and need to know if all users of our device will need to jailbreak or not.... I am happy to use a webapp instead of being on the store if thats going to make a difference?

We need to add an option to show on external screen. If specifics are needed I am happy to provide information in PM.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
I believe the audio only stream is encrypted and requires a key issued by Apple (a legacy of RIAA demands I'm sure), but the newer video standard is not (probably the reason HBO Go / Amazon Player / etc refuse to allow it). The key has been broken and is available but I'm quite certain Apple would sue you if you used it in a real piece of hardware that you sold to the public.

AirPlay devices are discovered via Bonjour/mDNS. Whether Apple would take offense to an unofficial AirPlay receiver device I don't know, but there are some open source projects that make an AirPlay video receiver on your local PC you could check out. The official channel is joining the hardware accessory program. I don't know how restrictive it is or how expensive. You might also see if anyone sells an AirPlay receiver chip that is already licensed and let them deal with it.


Edit: here is a reverse-engineered doc on AirPlay http://nto.github.com/AirPlay.html. You should test a device and see if it will respond with a non-encrypted stream. If so I don't think there is any legal problems as long as you don't call it AirPlay.

It looks like the Apple key auth requirement is in the receive side on old AirTunes gear (AirPort Express) so it might work. I don't know if third-party licensed receivers still require encryption or not - my guess is no.

Simulated fucked around with this message at 16:43 on Aug 5, 2012

haveblue
Aug 15, 2005



Toilet Rascal
Apple does have a track record of taking (non-legal so far) action against unapproved use of Airplay so I would be extremely careful with that project.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Ender.uNF posted:

I'm assuming you tested this on the device and not in the simulator.

Yes. Although I think my first-gen Core 2 Duo Mac mini might be slower than the iPad 3 I tested on.... =)

And thanks again for your reply, I'm changing my model today to move those properties to the base entity and having transient ones point to them.

zergstain
Dec 15, 2005

What kind of controls do they use for the +, - and gear buttons you see some places, like the Network and Users & Groups preference panes? I'd like to use something like that for myself.

As for my previous question, I gave up and did it manually after I didn't get an answer, but I would still like to know if it has to be done that way.

Doc Block
Apr 15, 2003
Fun Shoe
UIButton or UIBarButtonItem, depending on where it's going.

edit: never mind, you're talking about OS X.

zergstain
Dec 15, 2005

Found the images I want. I'm sure it's NSButton I want, just not sure what style. Square?

I'm also clueless about KVC, KVO, bindings and all that good poo poo. Any recommendations for tutorials?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I recommend:

"Key-Value Observing Programming Guide"
"Key-Value Coding Programming Guide"
"Cocoa Bindings Programming Topics"

zergstain
Dec 15, 2005

Edit: I shouldn't have said this. If I have problems with the official docs and included sample code, I'll try my luck with Google.

Speaking of RTFM, I found the button type I was looking for in the HIG. A gradient button. Didn't see guidelines on how to size the control though.

zergstain fucked around with this message at 01:36 on Aug 6, 2012

abraham linksys
Sep 6, 2010

:darksouls:
Hey, just started iOS coding a couple days ago. It's been fun.

One thing I've been wondering is the best way to pattern a view created in code. I have an app that creates a new view (page) for every entry it loads. The method for doing so is here:

https://github.com/thomasboyt/goonsay-ios/blob/master/goonsay/ViewController.m#L78

Right now, it seems kind of overly monolithic. My major concern, though, is that I'm basically just editing that code when I want to change things like font size or padding. I'm a web guy; I'm used to defining that separately.

Would it be better to make a big constants file that would have FONT_SIZE, HEADER_PADDING, etc.? Or is there a better way to architect something like this?

This was the only relevant thing I could find on Stack Overflow. The way the OP does it seems like it might be overkill, but I hate using defines for constants like two of the answerers suggest. Hmm.

abraham linksys fucked around with this message at 00:35 on Aug 6, 2012

rainmanjam
Dec 30, 2006

Well.. that was interesting. Would you mind doing that again?
I'm running into a hardware issue where connecting multiple bluetooth LE devices causes a bottleneck and I can not connect more than 5 or 6 without issues. I have external USB Bluetooth 4.0 (LE) dongles that I can connect to my Mac. I know that the IOS Simulator requires that you have an external USB Dongle to use Bluetooth in the simulator.

Is there a way to attach to additional dongles programmatically and reliably?

Small White Dragon
Nov 23, 2007

No relation.
The redemption codes you can generate for your app -- can they still only be used in the US?

xelfer
Nov 27, 2007

What's new, Buseycat? woa-aah, woa-aah, woa-aah

xelfer posted:

I'm wondering if something like this is possible using storyboards, or is my only option through code?

I have a UITabBarController with a UINavigation Controller/UITableView(1) embedded in it. This UITableView(1) then calls another UITableView(2):



I want to show UITableView(2) by default in the tab bar though, and still have the back Bar Button back to UITableView(1).

The visual representation I came up with is something like this:



But I'm guessing because the segue between 1 and 2 is manual, it won't really work. If I use a custom button, the push goes in the wrong direction.. and I'm really trying to do it similar to how the iPhone Mail app shows your email then provides the back button to your Mailbox list.. except within a tab view.

any ideas?

I managed to solve this using a manual segue, I described the answer here if anyone cares: http://stackoverflow.com/a/11824522/357291

haveblue
Aug 15, 2005



Toilet Rascal

abraham linksys posted:

Hey, just started iOS coding a couple days ago. It's been fun.

One thing I've been wondering is the best way to pattern a view created in code. I have an app that creates a new view (page) for every entry it loads. The method for doing so is here:

https://github.com/thomasboyt/goonsay-ios/blob/master/goonsay/ViewController.m#L78

Right now, it seems kind of overly monolithic. My major concern, though, is that I'm basically just editing that code when I want to change things like font size or padding. I'm a web guy; I'm used to defining that separately.

Would it be better to make a big constants file that would have FONT_SIZE, HEADER_PADDING, etc.? Or is there a better way to architect something like this?

This was the only relevant thing I could find on Stack Overflow. The way the OP does it seems like it might be overkill, but I hate using defines for constants like two of the answerers suggest. Hmm.

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.

Adbot
ADBOT LOVES YOU

lord funk
Feb 16, 2004

NSLinguisticTagAdjective

No, Xcode, not NSLinguisticTagAdjective. I have never used, nor will I ever use NSLinguisticTagAdjective. Why must you be so stupid. :(

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