I have a very basic application that has two buttons that are supposed to retrieve properties and display them on a label. The classes are simple, basically containing properties.
The thing that I am running into is that everytime I hit the play button, it showcases a screen that is all white/blank.
So far, I am assuming this is due to a goof up in the UI because as far as the classes are concerned, I am quite confident that they work i.e they do not report any errors.
This question is vague but if you guys have experienced a similar issue maybe you know what it is.
So I'll leave this question at this without inching into more description that is highly likely to be irrelevant.
Any leads people?
When I was getting started with iOS stuff, I found a good way to debug weird UIView behaviour was to set the backgroundColor property of each view to a different colour, eg:
[myView setBackgroundColor:[UIColor redColor]];
That way I could tell at least vaguely what was going on.
Related
I have different view controllers and i linked them using insertsubview
There are atleast three levels of subviews for every screen the users sees.
I havent tested it on device yet.
I want to know whether this causes any performance issues
Also, is using NavigationBarController pop and push views better than addsubview and remove from super view.
(I dont want the back functionality of NavigationBarController and want a custom header. That is why i didnt use NavigationBarController)
This is an interesting statement :
I haven't tested it on device yet.
My advice is simple :
Test it on a device.
Only you know what your app does - you can't possibly think we can answer your question with so little information! 3 doesn't seem a very big number but I don't know what each of those views is doing so maybe it's an issue, maybe not.
I would like to have a UITextField or UITextView in where as I do some input, alternatives will appear something similar to when you type an address in Mail Application, alternatives appear down and is possible tap them so get a better input user interface.(since there is no need to type the complete word or address or phone number)
I do know how to fetch data from Address Book framework, also how to input text in UITextField/UITextView and its delegates but I don't know what kind of structure to use for fetching and showing data as the user do his/her input.
I know basic CoreData if this matters,
I hope I can get some help.
UPDATE (2010/3/10):
I don't have problem make a native-like GUI but I am asking about the algorithm, does any body knows what kind algorithm is best for this thing? maybe some binary tree?
Or should I just fetch data from coredata everytime?
Thanks
Ignacio
UPDATE (2010/03/28):
I've been very busy these days, so I have not tried UISearchResults but it seems fine to me. BUT I wonder was there a necessity of deletion of the wining answer? I don't think is fair my reputation went down and couldn't see the winning answer. ;(
You don't need some advanced algorithm to do this kind of thing... if you want to search the address book, then you can do so each time the user types in a character (or however frequent you need to seach). To do this, just take a look at the UISearchDisplayController class. I learned how to do almost the exact thing by looking at Apple's TableSearch sample app.
That app searches a list of objects using different fields (All, Device, Desktop, Portable)... so you could adapt it to Address Book fields (First Name, Last Name, Address...). The only thing you need to change is the search within the Address Book. I don't know exactly what your requirements ask for but this should be what you need to get it done. If you have any trouble with the code let me know... but this example really helped me, so hopefully it works for you.
I was looking for the same thing a while ago. Something that people kept suggesting was the Three20 project (google it).
For my needs this was overkill because it requires the whole project to build and I didn't want the whole project. Plus it's more fun to try it yourself :)
I ended up starting from scratch and making my own:
I started out with a subclass of a UIScrollView to contain the different controls. I subclassed a UITextField and overrided "editingRectForBounds" to support multiple lines. The bit where the contacts are displayed is just a UITableView with a background color of:
[UIColor colorWithRed:0.92 green:0.92 blue:0.92 alpha:1];
And separator color:
[UIColor colorWithWhite:0.85 alpha:1];
This and the use of a shadow makes it looks like it's sunken slightly under the UITextField. I create the shadow with a custom UIView, loading it once and hiding it when required, but it works just as well with an image.
Finally, I made the blue pill shapes with a custom UIView which can intercept "touchesBegan" to know when they should change color.
Adding them is a simple matter of calculating where they need to go and using:
[myTextField addSubview:myBlueView];
Hope that helps!
I'm experiencing a bad looking graphical glitch with UIDatePicker, and I'm wondering if anyone else has seen and/or resolved it. It is something non-deterministic, because every once in a while it goes away and looks normal.
Check out the highlight and shadow bars are shifted...
alt text http://img.skitch.com/20091218-x45e3i7bxw2ir4euymwxdrifhb.jpg
I have tried removing all other graphical elements. I have tried removing my slide-up animation so that it just appears in place (I thought there might be a break in animating the sub-views). At this point, I'm out of ideas for isolating this thing.
Thoughts? Thanks guys.
It looks like the picker view has been resized which they shouldn't be (as shown in IB by their frame properties being greyed out). I'd imagine this is the cause of the problems.
Wow, so yeah, big "f you" from Apple to all the devs who don't use their crap Interface Builder. Turns out Daniel was correct and there is indeed a resizing bug with UIDatePicker. No mention of this in the documentation.
I would have left this as a comment to his answer, but I wanted to elaborate on the solution.
You can set the frame origins to anything, but the size MUST be 320.0, 216.0 or else you will have non-deterministic graphical glitches.
I would also like to link to this spot-on blog post about some strange date issues with the UIDatePicker control. The NSDate class was basically a huge screw up from a localization standpoint, and they've attempted to deprecate the issues, creating an even worse disaster in the process.
Recently I've been looking to create some way of showing a user that something is being loaded. I'm sure anyone with an iPhone has seen this is apps before but what is the best way of doing it?
I started using UIProgressHUD, however it was pointed out to me that you shouldn't really use private (undocumented) API's.
I then I moved onto this which is a custom version called MBProgressHUD, however in my experience with this is wouldn't show the loading part when trying to call it not from a button and I found it very buggy (It wasn't very hard to crash the example code given by just clicking away).
I then went on to find this by James Brannan from his book, however I'm not quite sure why he claims this is the "proper way" of doing it when I've seen many apps in the past with what looks like the UIProgressHUD.
Does anyone have any ideas?
EDIT: This is pretty good...
Thanks
There is no one "best" way. Another way to do this is to simply put a UIView atop your main view's subviews, mark its userInteraction property and grey it out when needed. You could even add a UIActivityIndicator as a subview of this "foreground" UIView, starting its animation when needed. When your loading has finished, hide/stop the activity indicator and clear the foreground view's color.
If you are talking about loading over a network, one good thing to start with is to enable the status bar network activity indicator:
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
Note that you have to set it to NO when you are done! That should only be used to indicate network activity.
That's a bit subtle though, it's a great idea to have some kind of progress indicator IF you can tell exactly how long something is going to take - downloads where you know the size and count incoming bytes, or uploads where you also monitor bytes outgoing and know the total size.
If your call length is very small or the size is not really known (web service call is a great example) then some kind of overlay with a UIActivityIndicator can be very relaxing (you can also make a custom variant with a set of images added to a UIImage view to animate). The key is, that if possible it should not block the user from doing other things if possible.
Also if you have multiple things going on, you might want to add messages describing what state you are in (like, "adjusting image", "uploading image", etc).
Hope you all are fine and also in best of your moods.
I have a little problem kindly help me to get its solution.
my Problem is:
I am using vertical search in my application, using method sectionIndexTitlesForTableView() of tableview i get all Character listed from top to bottom at rightside.
But this letters have fixed color. i need to change this color. Since i newbie i don't know how to deal with it.
Please help to get solution.
Thanks, and sorry if you found me with wrong english.
There is no supported way to do this. Even if you had access to the index view (which you don't easily), it would not be possible because there is no NSAttributedString on iPhone, so you couldn't return color information.
The best way to achieve this is to turn off the tableview's index and generate your own from scratch, floating it over top of the tableview. But I would not recommend this approach for a new iPhone developer. It is best to spend some serious time learning to build UIs the way Apple intends you to. Once you understand Apple's UI and how it's implemented, then you can make informed decisions about whether you should break the UI rules.