iPhone App: How do they do that? - iphone

I am sure many of you would have seen Jamie's Receipe app.
In that, they have a shopping list. If you click on an item in the shopping it, it animates and strikes off that item from the list.
I would like to know how do they do that? How can we have such a strike off?
Thanks!

the answer is the same as in all those "how do they do that?" question.
They've created a custom UIView that does this.
Programming is not just arranging available Interface elements. Sometimes it involves the creation of something new.
EDIT: The strikeouts are indeed only images. You can find strike_out_0.png to strike_out_3.png in the app bundle.

most likely it's just a UIImageView placed on top of the text and then animated.
This has information on how to animate a UIImageView
http://appsamuck.com/day2.html

Related

How can I make a grid similar to iphone/ipads launcher screen?

I have seen a few grids made with UITableView but I don't really like how close together each cell is to the other. If there is a way of creating a grid system like the home screen on an iphone (the screen after it is unlocked) if would be great. I don't need an exact solution but a point in the right direction, maybe a set of libraries to look through would be great. I am running xcode 4.4.1
Thanks!
The key is UIScrollView has a paging mode (since could have more buttons than fit in the view). It's covered here's in Apple ocs:
http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/UIScrollView_pg/ScrollViewPagingMode/ScrollViewPagingMode.html
If you use that, each 'page' would have n buttons/views that when clicked would call a protocol/delegate call back for the consumer with the data to handle and it would evenly layout the UIView/buttons across that page view. Contact me if you want my sample.
You probably don't want to require iOS6 as a minimum requirement but if you do, you can do as H2CO3 suggested in the comment and us UICollectionview. Here's a tutorial: http://www.raywenderlich.com/22324/beginning-uicollectionview-in-ios-6-part-12
There's also some open source launchers that you can look into their code. Here's some (I'm sure there's more).
http://www.cocoacontrols.com/platforms/ios/controls/sespringboard
Code is at: https://github.com/sarperdag/SESpringBoard
Also: http://www.cocoacontrols.com/platforms/ios/controls/openspringboard
Use UICollectionView. You can create grid type views using that. It is available in iOS 6.
If you can target iOS 6+, use UICollectionView. It's one of the best new things in iOS for years and it will be as important as UITableView.
The layout you're asking for is only a few lines of code.
NSHipster has a good explanation of UICollectionViews and Ray Wenderlich has a good tutorial.
(There's lots of example code out there, but here's a very simple example project I did recently for another question involving UICollectionViews)

Developing a swipe and view change iPhone application

I am trying to develop an application whose view closely matches with groupon app. User should be able to swipe on the screen and the entire screen changes with top pointer pointing to different tool bar entity.
Any pointer of how to go about it?
Take a look at UIScrollView Reference and PageControl Reference from Apple Guides
Hope it helps,
Mário
Looks like a pagecontrol+scrollerview
The complex part is making the toolbar elements move when you are changing the page at a different speed

iPhone SDK - Expanding Buttons like in the camera app

I am curious as to whether or not there is an open source solution to replicate the flash button in the iOS camera applicaiton.
I have seem many other apps use this, but there doesn't seem to be a native way, so I assume there is a common source out there.
It is possible to get the flash button by using UIImagePickerController class, but most of the camera apps out there don't seem to be using this (or perhaps they subclass it, which is against apple's terms).
I am looking for a way to replicate the expanding behavior of the button. Any thoughts?
It doesn't sound too hard.
The way I'd do it is to separate the right curve of the button (as images), and make a UIView that has the left part of the button and the right curve as subviews.
When it's tapped, slide the right curve and animate the extra buttons in.
You could use a stretchable UIImage (see UIImage documentation) and then just animate the frame changing.
In the Apple 2010 WWDC Sample code (downloadable via iTunes, otherwise I'd post it here), there are several sample applications which use this control. They call the class ExpandyButton. I realize I'm answering my question, but hopefully someone out there can find this useful.
While looking for a similar solution to this problem I came across this code which was extremely helpful. Similar to ExpandyButton it fit my needs better.
https://github.com/ddebin/DDExpandableButton

UIPickerView that scrolls horizontally on the iPhone?

I'm taking a look at this widget, and it appears to be a UIPickerView, however I haven't seen anything provided by the iPhone SDK API that allows for horizontal scrolling only. Mostly it's all done vertically. Also there appears to be a custom graphic around this picker, so it might not be that either.
I'm curious if anyone is able to determine if this is indeed a UIPickerView or perhaps a hacked up UIScrollView? The widget is handy -- and I like its use. I found it in some random groceries app in the app store.
Here is the screenshot:
Thanks all.
I'd definitely use iCarousel library:
https://github.com/nicklockwood/iCarousel
The library is really well documented, the code is clean and maintained.
That is totally custom. You could indeed do something of the sort overlaying an UIImageView and an UIScrollView. I'd guess it's a 100% custom. As with all programming, there are many ways to do any single thing.
As I recently posted in response to this question, a class for an iOS horizontal picker control (STHorizontalPicker) has just been posted on GitHub. It's nowhere near as sophisticated as UIPickerView, but it provides the basic functionality for picking numeric values and the underlying foundation is probably a good starting point for adding more sophisticated functionality (it's a UIScrollView containing a UIView with multiple CATextLayers for the markers).
It was designed to be used in UITableCellViews and currently looks like this:
This website has source code for a picker that is aligned horizontally without subclassing it.
That definitely looks like a custom component. I'd suggest getting the .app file off your iPhone, opening up the bundle, and looking to see if there's a xib file for that interface. You may get lucky and find the component sitting in there. My guess is that it's a subclass of UIScrollView, but of course there's no way I could be sure of that without personally knowing the developer or the codebase.
You will recognize pickers by their giant screen-gobbling footprint :-) This is most likely a horizontal UIScrollView with a series of fixed-width labels (or images). The tricky bit is to have the bezel on top with a transparent center pass touches back to the underlying scroll view. Or you can take the easy way out and overlay four image strips (for each edge) and leave the middle open so touch events go directly to the scroller.
It's a custom control, but it's really not that hard to build.

iPhone: add badge to icons internal to my app

I am trying to add badges to the icons in my app. e.g. in the facebook app, in the home page the number of pending requests is shown on the requests icon.
Can someone provide any links/ideas on how to do this?
Thanks,
V
I know this article is a little bit old, but it helps me recently to make a little class to create custom badges. I thought it would be fair to make this class public for everyone. So here it is CustomBadge.
best regard
- Sascha
Lots of ways to do this. You can overlay a UILabel over the icon (which may be a UIView or UIImageView). YOu can put another view on top of the icon, and draw the text right into that view. Or make your icon view be a subclass of UIView, and when you get called to draw, you draw the icon and the number.
Plus, you may want to play with blend modes, shadow, masking, etc., in order to create something that is visually attractive.
I'd probably start with reading more about Quartz, if you haven't already. The rest is just how you wire it all up.
And some other links:
http://scientificninja.com/development/numeric-badges-on-the-iphone
http://th30z.netsons.org/2009/03/qt4-drawing-notification-badges/
alt text http://th30z.netsons.org/wp-content/uploads/qtdrawbadges.png
The Three20 project (its code is part of the Facebook app) has those badges.