UIPickerView not showing up - iphone

I have a UIPickerView that wont show up when I run the app because I created it programmatically and I'm using a UIImage as a background for the app. How can I get it to show up ? I have tried
[super.view sendSubviewToFront...];
and it still doesn't show up. Any idea why?

I dont have my Mac rite now but ill give you the basic idea . What you should really do is after allocating both the image and the pickerview ; first addSubView the UIImage onto the self.View and then addSubView the UIPickerView on the UIImage like
[self.View addSubView:image];
[image addSubView:pickerView];
Any doubt let me know . Thanks .

Related

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.

Issues setting up a back ground image and with UIImageView

On my iPhone app, I simply want to set a particular background image, which depends on whether it's an iPhone 5 or not.
So, I tried two approaches:
A) Using
self.view.backgroundColor = [UIColor colorWithPatternImage:backGroundimage];
B) Creating an UIImageView and setting up the image there. Code:
UIImageView *backgroundImageView = [[UIImageView alloc]initWithFrame:screenBounds];
[backgroundImageView setImage:[UIImage imageNamed:backGroundImage]];
[self.view addSubview:backgroundImageView];
But I am having issues with both of them:
Issues with Step A:
When I set the image through that way, I have to deal with the image scaling issues for different sizes of the screen. I use the following code to do the scalling:
UIGraphicsBeginImageContext(screenBounds.size);
[[UIImage imageNamed:backGroundImage] drawInRect:screenBounds];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
self.view.backgroundColor = [UIColor colorWithPatternImage:image];
Another issue from Step A is that the image appears quite blurry. It doesn't have the same sharpness to it.
Issues with Step B:
With this, the image looks really crisp and sharp - just the way it should look.
But when I switch to another view using the following code, strangely enough the UIImageView backgroundImageView still appears on the second one. The code I use to switch views is:
[self presentViewController:secondViewController animated:YES completion:nil];
I even tried [backgroundImageView removeFromSuperview], but that doesn't solve anything either.
So what am I doing wrong? And how can I set up a picture as my background which is dependent on the size of the iphone?
Plan B is a good plan. Presenting another view controller should and will definitely hide your image view. If it isn't happening, then it's a problem with the creation of secondViewController, unrelated to the background image on the presenting VC.
Before presenting secondViewController, log it:
NSLog(#"presenting %#", secondViewController);
I'll bet a dollar that it's nil. If I'm right, let's have a look at how you initialize secondViewController. That's the problem, unrelated to the background image view.
Okay, I finally fixed this issue, although the cause of this issue is still puzzling to me.
To fix this, I had to create an IBOutlet property for UIImageView and hook it up on the XIB file.
The reason I was programmatically creating the UIImageView is because the size of the UIImageView depends on what size iPhone they are using. But for the IBOutlet (let's call it as UIImageViewOutlet, I simply used [self.UIImageViewOutlet setFrame:] to get the size and location that I wanted.
I also discovered that one of the buttons that I was programmatically creating, was still visible in the secondViewController. I ended up creating an Outlet on the XIB file for that one as well and used setFrame on it to position it properly.
If anyone who knows the reason of this problem, I will be very grateful.

How to set an image as the background view for a uiTableView in XCode 4.3.2

XCode Version: 4.3.2
iOS 5.0
I am trying to set the background image for my TableViewController. I have a table already in the controller, just not sure how and where (which method to write the code in) to set the background image for this. Once I set it does anyone also know how to put the table at the bottom of the screen? If someone can outline the steps, i would be grateful.
Really appreciate some help!
I do it inside the viewDidLoad method. For example so:
UIImageView *bgView = [UIImageView ....];
self.tableView.backgroundView = bgView;
[bgView release];

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

Image not appearing in UIImageView

I have a UIImageView in Interface Builder connected to an outlet called imageView. The statement
[imageView setImage: [UIImage imageNamed: #"xxxx.png"]];
displays an image successfully if placed in viewDidLoad, but NOT if placed in an action method in the same view controller. There's an NSLog in the action method so I know it's firing.
I've looked at the other "UIImageView not appearing" questions but none of them seem directly relevant. Any help would be much appreciated!
Thanks,
Mark
Try forcing a redraw:
[imageView setNeedsDisplay];