Which UI object to do this? - iphone

I have seen many times waiting panels (panels with a uiactivityindicatorview) black/dark with some transparency and white labels.
Like this one :
I guess it is a standard element.
Where can I find it?

Try This. it's the best solution I came across to show the activity. MBProgressHUD

MBProgressHUD looks nice. You might want to check out http://code.google.com/p/toast-notifications-ios/ too.

There's no iOS component that does this.
If you don't want to include an external library just for this one component then you can do it using UI components.
/* Warning, typed from memory */
// Create the UIView that's the background
UIView *pleaseWaitView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 80)];
[pleaseWaitView setBackgroundColor:[UIColor colorWithWhite:0.5 alpha:0.5]];
[[pleaseWaitView layer] setCornerRadius:5.0f];
// And create an activity indicator
UIActivityIndicator *i = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[i startAnimating];
[pleaseWaitView addSubview:i];
[i release];
// Add it to the main view (in the middle)
[pleaseWaitView setCenter:CGPointMake(self.view.bounds.size.width/2, self.view.bounds.size.height/2)];
[self.view addSubview:pleaseWaitView];
You can add a UILabel with whatever text you want (in your case, 'Authenticating') in the same way as you added the activity indicator.
The tricky part is setting the corner radius - you will probably need this at the top of your .m file :
#import <QuartzCore/QuartzCore.h>
NB You can do this in interface builder as well if you want (apart from the corner radius bit!) ;)

I answered a question that included an overlay like this. I included the code and the overlay image you need to do it with. Take a look at this answer and take a look at the screen shot it created. I use this overlay as I send email in the background so you will want to edit the code to do your function but the overlay code is already in place.
Locking the Fields in MFMailComposeViewController
Happy Coding!

Check out DSActivityView. I've successfully used it in a few of my projects.

As by now there is no standard UIElement for that in iOS.
But checkout this library:

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...

Expandable UITextField with option for inserting image

I want to make the same view as iPhone default message app here is the screen shot what i want to do so can any one help me for suggesting 3rd party control or technique for making this kind of control in my app
Here is the Source code you wanted for the Growing TextField , although it doesn't contains the image button but you can easily customize it to fullfil your requirement
https://github.com/HansPinckaers/GrowingTextView
Hope it will help you.
You can add the image view as a subView of UITextView.
Create an imageView with image:
UIImageView *imageView = [[UIImageView alloc] initWithImage:yourImage];
[imageView setFrame:yourFrame];
[yourTextView addSubview:imageView];
and can use third party library for this Here
Hope it helps you.
you can directly add your image view on text view.
Tried this one
UIImageView * image=[[UIImageView alloc]initWithImage:[UIImage imageNamed:#"xyz.png"]];
[textview addSubview:image];
this will really helpful.

iOS views - how to remove excessive shadow?

I have a UIViewController that I'm nesting inside another UIViewController (iOS 4.3+),
it is displayed just fine except one thing - a lot of excessive shadow.
I have tried removing it with setShadowRadius etc, but no luck..
This is the code I use to create it:
RDPreviewViewController* preview = [[[RDPreviewViewController alloc] initWithNibName:#"RDPreviewViewController" bundle:[NSBundle mainBundle]] autorelease];
[preview.view.layer setShadowOpacity:0.0];
[preview.view.layer setShadowRadius:0.0];
[preview.view.layer setColor:nil];
[preview.view setFrame:CGRectMake(0, 100, 320, 264)];
[self.mainView addSubview:preview.view];
And here's the result:
How do I remove it?
I suspect - and this is a theory - that given what you've said that somehow your PNG image with the subtle shadow is being loaded multiple times. This is why your shadow appears much darker than you're expecting - several identical PNGs are being overlaid on top of each other.
The reason I think this is the case is that judging from the code you've posted you're not programatically applying a shadow, and views do not have a shadow by default. Of course, perhaps you are adding a shadow in your code elsewhere, but based on my own experience I think it looks as if somehow the same view (your image view) is getting added multiple times.
It might be helpful if you shared more of your code, if possible.

iOS: Creating tip / help popups

Are there any built in, open source, or tutorials for creating a reusable easy to use popup for use with in game-help.
Essentially I would like to, on first run of a game, show popup tips / help that "point to" various on screen objects to help a user orient themselves with the game.
Update: Here is an example of how I ultimately want it to look / behave although I don't need it that generic but as close as possible would be good
I like those: https://github.com/chrismiles/CMPopTipView.
Nice and easy to set up.
Essentially what you need is a custom view.
You cannot use Apple's UIAlertView since its purpose is very different from what you are looking for.
I don't know what are your specific needs, but you may use a simple UILabel:
CGRect ref = objectToAddress.frame;
UILabel *tip = [[UILabel alloc] initWithFrame:CGRectMake(ref.x+ref.width,
ref.y+ref.height,
width,
height)];
[tip setText:messageToShow];
[self.view addSubview:tip];
[tip release];
where width and height are the dimensions of the tip you want to show and messageToShow is the message you want to display.
You can, of course, customize your UILabel as you like, changing font or background color. Check the reference for additional informations.
EDIT:
You may take a look at a possible popover implementation for iPhone: WEPopover. On the iPad you can use directly Apple's UIPopoverController
What I've done is to create two functions
- (void) showOverlay: (BOOL) show withMessage: (NSString*) message
{
if(show)
{
// I create or load a UIView with labels, etc, and with an alpha of 0.6/07
// give it a tag for later dismissal
overlay.tag = tag; // any arbitrary value
// add as subview
[self.view addSubview: overlay];
}
else
{
// hide the view
UIView *overlay = [self.view viewWithTag: tag];
[overlay removeFromSuperview];
}
}
Then I have a hide overlay function
- (void) hideOverlayInSecs: (NSInterval) time
{
[self performSelector: #selector(hideOverlay) withObject: nil afterDelay: time];
}
Then you can write a wrapper function to show / dismiss it for varying durations
[self showOverlay: YES withMessage: #"help tip"];
[self hideOverlayInSecs: 2];
In my App, the tips were fairly static, so I created an tip image using my favorite image editor, and then simply created a UIImageView with the tip image, and then added that as a subview to the current view, making sure to place it on top of other views.
It worked out pretty nicely, but again, my tips are fairly static.
If you want to display them only on the first run through, you'll need to create a BOOL that is saved in NSUserDefaults or something.
How about this?
I wrote this myself. It's pretty simple and probably what you are looking for.
Popup any UIView instance on top or bottom then disappear after a few seconds.
https://github.com/SaKKo/SKTipAlertView
Hope you find it useful. cheers,

iPhone - user interaction with programmatically added UIImageView

So I'm trying to add UIImageViews programatically (in this case I don't have the option of doing it in IB) and I want to be able to refer to them and manipulate them in the -touchesBegan and -touchesMoved methods.
I've added the images like this:
UIImageView *newPiece = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:#"%d.png", [piece tag]]]];
newPiece.frame = CGRectMake(pieceX, pieceY, pieceW, pieceH);
[newPiece setCenter:CGPointMake(pieceX, pieceY)];
[newPiece setTag:[piece tag]];
[[self view] addSubview:newPiece];
[newPiece release];
And note, many of these newPiece's are added programmatically, because the method that this is in is called more than once, so the images have different centers and images and stuff, so would I need an array to hold all of them?
Thanks
NSMutableArray would probably suit your needs.
Check this very detailed post. It's precisely about handling several programatically added UIImageViews and it worked nice for me.
Create multiple views and make the touched view follow the users touch
Best luck.