UIPopoverController for iPhone - iphone

Does anyone know of how I would go about creating a UIPopoverController like the one found in Tweetbot form Tapbots? For months I have been trying to figure this out and gave up thinking it wasn't possible. When Tweetbot received an update with this, it made realize it is possible but I still can't seem to figure it out. Does anyone know of classes I could download that has an identical UIPopover?
Thanks
Edit: http://d.pr/LPI9

Popover controllers are for use exclusively on iPad devices. Attempting to create one on other devices results in an exception.
If you need custom popOverController check this link
Custom uipopovercontroller for iPhone

TestTableViewController *vc = [[TestTableViewController alloc]initWithStyle:UITableViewStylePlain];
[self addChildViewController:vc];
[self.view addSubview:vc.view];
[self.view bringSubviewToFront:vc.view];
[vc.view setFrame:CGRectMake(20, 20, 100, 200)];
You can create a child view as uipopviewcontroller , beware not add childview on a scrollview , otherwise the scroll effect vanishes .

Related

placing smaato ads in different positions

I'm starting to know smaato and I'm planning to shipping it with my first published app. I used the method in the documentation
banner = [[SOMABannerView alloc] initWithDimension:kSOMAAdDimensionDefault];
[[self view] addSubview:banner];
To create the banner and then place it in the main view. It appears nice and pretty in the top. The thing is, I want it to be presented in the bottom of the screen. I know it's best for advertising to go in the top, so it drives more user attention, but for this case I just need it in the bottom. I tried making a subview with a rect and adding the banner to the subview, but it still shows up in the top. I read trough the little documentation to find nothing.
Has anybody came up with this problem before?
Never mind, for some reason it didn't work last night but it does right now. For others with this same problem, the fix was putting a low subview and loading the banner there.
UIView *vista = [[UIView alloc] initWithFrame:CGRectMake(0, 400, 380, 50)];
[vista addSubview:banner];
[[self view] addSubview:vista];

Which UI object to do this?

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:

ABPersonViewController drawn under the navgation bar

The context:
I am working on an app that maintains a list of contacts along with their record IDs for it's own reference.
When the user needs to change the number associated with a specific contact within the app, I am trying to display the ABPersonViewController so the user can choose the new number from the contact in AB.
The problem:
The problem is that the ABPersonViewController that is opened is starting all the way from the top of the screen as if it does not know that there is a navigation bar on the top.
As a result some of the top part of the ABPersonViewController screen (the top part of the person image and the top part of the name) is underneath the navigation bar.
Ideally i want it to look like this, but not in edit mode: http://developer.apple.com/library/ios/documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Art/person_view.jpg
Also I wanted to add a "cancel" button to the top right part of the nav bar. Trying to add that as a bar button is not working either.
The code:
this is how I am adding the ABPersonViewController to the navigationController:
ABPersonViewController *personViewController = [[ABPersonViewController alloc] init];
personViewController.personViewDelegate = self;
personViewController.displayedPerson = person;
[self.m_circleNavController pushViewController:personViewController animated:YES];
[personViewController release];
The self here is a UIVIewController.
The m_circleNavController is the UINavigationController to which the UIVIewController belongs.
I tried these 2 ways of showing the person view, but both behave the same way.
[self.m_circleNavController pushViewController:personViewController animated:YES];
[self.navigationController pushViewController:personViewController animated:YES];
I'm not too sure what I am doing wrong, or what is the best way to do it.
I tried a lot of different ways to display it in vain.
The viewcontroller was behaving as though it was starting about 40 pixels above the top edge of the screen.
I was able to fix it in a very weird way finally. In the init function of the viewcontroller I added the following line:
self.view.bounds = CGRectMake(0, -43, 320, 440);
But still no clue as to why it happens this way. I was to close to the deadline to look for a decent solution.
Hello I've been having the same problem as of the new iOS. When this happens on my custom view controllers I have been able to correct it with:
if (self.interfaceOrientation != UIInterfaceOrientationPortrait) { // UI is in landscape position
[self.tableView setContentInset:UIEdgeInsetsMake(32,0,0,0)];
} else { // UI is in portrait position
[self.tableView setContentInset:UIEdgeInsetsMake(44,0,0,0)];
}
But when using the ABPersonViewController I don't quite know how to handle this problem.
Hope someone has an idea...

ViewController displaced vertically by 20px after modal is dismissed: iOS4 Only. Example code included

I hope someone can help... This issue has been discussed here and I have tried the solutions suggested but to no avail.
My problem is best illustrated using the example project which can be downloaded from this URL:
http://www.hitsalive.com/tmp/VCTest.zip
In the example project I have a main UIViewController with two buttons used to call two other UIViewControllers - one using presentModalViewController and the other using "addSubView" (using the AppDelegate). Individually both buttons and UIViewControllers work fine.
However, if I first call the modal viewcontroller, then dismiss it (using dismissModalViewControllerAnimated: YES) and then display the second (addSubView) UIViewController, then all elements and subviews in the second UIViewController (such as the button in the example) get displaced downwards vertically by 20 pixels. And the displacement happens with a momentary delay.
This issue does not happen with SDK 3.2 and below -- just iOS4.
Any help would be appreciated, especially with reference to the example project above.
add [aViewControllerTwo setWantsFullScreenLayout:YES]; to your - (void)flipToViewControllerTwo after ViewControllerTwo *aViewControllerTwo = [[ViewControllerTwo alloc] initWithNibName:#"ViewControllerTwo" bundle:[NSBundle mainBundle]];
In order to solve this you need to do the following with the view controller that appears shifted: add a frame, then set the position of this frame appropriately. Set this frame to the view of the ViewController.
shiftedViewController* ShiftedViewController = [[ShiftedViewController alloc] init ];
CGRect theFrame = [shiftedViewController.view frame];
theFrame.origin.y = 20;
theFrame.origin.x=0;
[shiftedViewController.view setFrame: theFrame];
[self presentModalViewController:shiftedViewController
animated:YES];

How can I display a introduction modal view when the app start up?

I have a tab bar application and I want to display those views that most part of apps have, with the name of the company or the name of the app.
I've created the follow viewController
Introduction *introducao = [[Introduction alloc] initWithNibName:#"Introduction" bundle:nil];
I don't know where exactly should I insert the code to show the modal because I have a tab bar application:
[self.navigationController presentModalViewController:galeria animated:YES];
I've tried to insert these lines on appDelegate.. but didn't work.. somebody have an idea?
if you are trying to show a splash screen right when the application opens, you should use a Default.png image instead of a view controller showing an image. Check out the Apple Documentation on Human Interface Guidelines and Beginning iPhone Development.
First of all, you'll need to ensure that you have a navigation controller present to present the model view from. Otherwise in the above code you'll be messaging nil and nothing will happen. Then you'll want to put the presentModalViewController:animated: call in your app delegate's applicationDidFinishLaunching: implementation.
Thanks for all answers.. they were very useful to understand better the process..
I have found a solution that does exactly what I need! So if someone need to create those splash screens with a sequence of images it is very useful:
Just create a ImageView on the Delegates Header and do the following:
splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
splashView.image = [UIImage imageNamed:#"Default.png"];
[window addSubview:splashView];
[window bringSubviewToFront:splashView];
to control the duration of the splash screen:
[self performSelector:#selector(removeSplash) withObject:nil afterDelay:1.5];
To remove the splash:
-(void)removeSplash;
{
[splashView removeFromSuperview];
[splashView release];
}
so If you want to create a sequence of image just create a method to change the splashView.image.. and create a NSTIMER to call it..