iOS Safari refresh button. Can I use it? - iphone

I have some text field and I need refresh button like in Safari navigation bar.
How can I use it instead of making my own?

The refresh graphic itself can be extracted using UIKit Artwork Extractor. (Or, get a refresh icon from one of the many free iphone icon sets, like Glyphish)
To place it in a UITextField like in Safari, set the UITextField rightView property to a UIImageView or UIButton with the image set to the refresh image.
UITextField* myTextField = [[[UITextField alloc] initWithFrame: CGRectMake(0,0,200,44)] autorelease];
myTextField.rightView = [[[UIImageView alloc] initWithImage: [UIImage imageNamed: #"UIButtonBarRefresh.png"]] autorelease];
You'll want to use a UIButton instead of a UIImageView if you want to get the TouchUpInside notification for the refresh button.

It's a custom safari widget. You have to make your own.

Related

How to change pull to refresh icon of tableview in swift? [duplicate]

I have been looking around but couldn't find anything good about this.
I would like to customize the default UIRefeshControl with different loader, etc. So far I can only change tintColor & attributedTitle properties and most code I found are just basically creating a new "pulltorefresh" effect but what I want is to just use the UIRefreshControl and customize it a bit.
Is this possible?
You can't add different loader without accessing private APIs, but you can add background image:
UIImageView *rcImageView =
[[UIImageView alloc] initWithImage:
[UIImage imageNamed: #"refreshControl.png"]];
[self.refreshControl insertSubview:rcImageView atIndex:0];
assuming self is an instance of UITableViewController subclass.
Image size you need is 320x43px (#2x 640x86px), the middle area (approximately 35px) will be covered by the loader animation.
I show application logo there...

Disable UIView and controls

When a user clicks on a button a popup similar to this image appears. But when i am on a slow internet, the popup takes awhile to load. so until the popup loads i need the view in the background (where the button resides) to freeze (disable) and the user should not be able to click on any controls.
How can i disable the view/control ?
See -[UIView userInteractionEnabled]
http://developer.apple.com/library/ios/documentation/uikit/reference/uiview_class/uiview/uiview.html#//apple_ref/occ/instp/UIView/userInteractionEnabled
Set
view.userInteractionEnabled = NO;
On the parent view of the controls you'd like disabled.
Set the button's enabled property to NO - if you're using UIButton or a subclass thereof.
ex.
[button setEnabled:NO];
UIView *testView = [[UIView alloc] init];
testView.userInteractionEnabled = NO;

How to show XML parsed images by using Tap gestures in iphone?

I am making an App in which i am parsing an XML and storing the url of images in an array.
Now i have to show all that images on next View Controller using Tap Gestures and when i click on images i have some action to perform. So please can anyone help me regarding that?
I can provide the code what i have written if anyone want or tell me some tutorial as i am not able to get it from developer sites.
Load your images into UIImage objects like so:
UIImage *imageFromUrl = [UIImage imageWithContentsOfFile:[NSURL fileURLWithPath:url]];
Then, place them into UIImageView objects wherever you need them. The next thing you should do is add a TapGestureRecognizer:
UIImageView *imgView = [[UIImageView alloc] initWithImage:imageFromUrl];
UITapGestureRecognizer *tgr = [[UITapGestureRecognizer alloc] initWithTarget:self action:#selector(action)];
[imgView addGestureRecognizer:tgr];
[tgr release];
//Do the rest of your operations here, don't forget to release the UIImageView
And that's it. Do whatever you need in the "action" method that will get called on your ViewController
For that you have to use TapDetactingimgView.
In that view you get scroll,single tap & double tap event.By that you can scroll image & able to tap on that image.
for that Visit : https://bitbucket.org/billgarrison/panzoomimagedemo/src/34671df61417/Classes/TapDetectingImageView.m

Using Image to Perform an Action instead of Button in iPhone Applciation

How can i use image to Perform an Action instead of Using Button or adding an image to Button, just wanna click button and perform particular set of instructions.
(Thanks in Advance)
Use a UIGestureRecogniser.
// IF your image view is called myImage
UIImageView *myImage = ...;
// Add a tap gesture recogniser
UITapGestureRecogniser *g = [[UITapGestureRecogniser alloc] initWithTarget:self action:#selector(imagePressed:)];
[myImage addGestureRecogniser:g];
[g release];
When your image is tapped, this method will get called
- (void)imagePressed:(UIGestureRecogniser *)recogniser {
NSLog(#"%#", recogniser);
}
Why don't you want to use a UIButton - it inherits from UIControl and has a lot of code that you probably don't even know exists? And it can just contain an image so it would look exactly the same?
Well, the pro about using UIButtons is that it got all touch events built right in. You can use UIImageViews, but you'll need to subclass them, while in most situations, a UIButton using a background-image would just fit.

How to set the button created in the navigation bar as custom in iphone?

I am new to iphone development.I have created a UIBarButtonItem on the navigation bar.I want to set the proper to custom. There is no property as custom for "style:" attribute.Please help me out.Thanks.
leftbutton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:#"LEFT.png"] style:UIBarButtonItemStylePlain target:self action:#selector(leftbutton)];
self.navigationItem.leftBarButtonItem = leftbutton;
[self.navigationItem]
[leftbutton release];
If you just want to display a .png file inside the usual button frame from Apple, then your code is ok. If your png file is not displaying, just check if it's valid.
If you want to make your own button, you can use -(id)initWithCustomView:(UIView *)customView
Check this post for an interesting sample code :
Custom Bar Button Sample Code
You can create item with - (id)initWithCustomView:(UIView *)customView method with whatever custom view you want.
UIBarButtonItem has 4 initializers which cover all you will ever need:
-initWithBarButtonSystemItem:target:action: for standard (built-in items);
-initWithTitle:style:target:action: for buttons with title and no image;
-initWithImage:style:target:action: for buttons with image and no title;
-initWithCustomView: for any UIView subclass, Apple's or your own.
The style property makes sense only for standard buttons.