I want my app to have a large header like the living social app:
I tried doing this by hiding the navbar on the main delegate and just making a UIImageView to hold the pic, but the transition to the detail view looked funky. How can I get a custom image at the top of my tableview? Maybe I did something funky and need to try again?
YournavigationController.navigationBar.frame = CGRectMake(0, 0, 320, 100);
And on top of that, this site has a good tutorial on how to add a background image to the UINavigationBar, these two things together should give you just what you're looking for!
http://sebastiancelis.com/2009/12/21/adding-background-image-uinavigationbar/
Should to the trick!
Related
I'm working on an iBooks type of app for iOS 5 and have everything working except for the background image. Specifically in landscape mode.
Up to this point I've been using:
UIImageView *background = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"book.png"]];
[self.view addSubview:background];
[self.view sendSubviewToBack:background];
If I do this on the RootViewController, the spine obviously doesn't show through the page view controller's view and if I use this inside the page view controller class, it removes the ability to use CGRectInset to specify where the pagecurl should begin.
I'm sure this is probably something pretty basic, but I've looked through every book that I have as well as Google, and I don't see this covered anywhere. Any help would be appreciated.
Thanks
You will need to use a background image for your book and then use a right page image for the right side and a left side image for the left side. These will need to align and match up with the full book background image. You can use a UIImageView for all three. Keep in mind that the left and right page images will need to be perfectly square (except for the spine) with no transparent area, otherwise you get a weird shadowing effect. Also make sure all background colors are set to clear.
So you will have this hierarchy:
Root View (full screen bounds)
Book Background View (However big you want)
Page View Controller (A little smaller than the book background view, you'll have to play with this until everything looks right)
Left page view controller
Image of left page and whatever else goes on the page
Right page view controller
Image of right page and whatever else goes on the page
I hope this makes sense.
Apologize in advance as I'm still new to Xcode.
I have a 2D game build entirely in one viewController. I would like to add both a start menu and in game menu to the game. I assume the best way to do this is through another instance of a viewController? Any advice or suggestions would be very helpful.
First place a UIView on your Xib or UIStoryboard.
Put 2 buttons on it and make their connections and outlets.
The view you want to open is view_Menu.( let us consider)
Now for managing view you need to do this:
view_Menu.frame = CGRectMake(xAxis, yAxis, self.view.frame.size.width, 150);
[self.view addSubView: view_Menu];
In xAxis and yAxis you can put your values.
Now when you click any button inside the menu view you can simply call this method:
[view_Menu RemoveFromSuperview];
So it will help to provide you that you want. A bit of things that you can put a background image or make some custom animations for better look.
I want to achieve such effect,but I'm searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this.
You could put header view inside tableHeaderView like this:
self.tableView.tableHeaderView = headerView;
Background imageView put under tableView.
Last thing is top status bar background rectangle,
I recommend to use this library https://github.com/telly/TLYShyNavBar
I want to create a fixed header that doesn't scroll with tableViewCells, or other content that I have. The header should stay in place fixed, just like in most iOS apps.
Here is the image of the issue I'm facing:
I tried embedding it in a NavigationController & a TabViewController. That didn't work.
I also tried adding a scroll-view.
I referred to this link but it's outdated and didn't help: how iphone facebook app make the navigation bar fixed
Thanks.
I'd really recommend fooling around with the Navigation controller until you figure it out, it's really the best method for this. If you've embedded it, I'd check out your view with the Attributes inspector, to make sure everything needed is enabled.
HOWEVER, there is another way I've used before. Create a new ViewController, and create two views inside of it. One will be your FakeNavBar, and the other will be a container/TableView that'll hold your data.
Once you've added both these to your new VC, just set them up normally, and bingo!
One tip for this, is that NavBar is typically 64 points high, so your fake bar will be something like this:
fakeNavBar.frame = CGRectMake(0, 0, theWidth, 64)
tableView.frame = CGRectMake(0, 64, theWidth, theHeight-64)
And your view hierarchy will look like this:
I am making an app in which there are two buttons in the center. The background is there and I need the background to have an animation. With that said I mean like little raindrops constantly falling in the background. I have no clue on how to do this. My customer really, really wants this. Thanks!
Make sure the images are named in numerical order with the number at the end of the name. Then drag and drop the file of images into your Xcode folder area. Then you reference only the image name and not the number in animatedImageNamed.
You need to create an ImageView the size of the Background for each device you plan on using.
//place this in your viewDidLoad
UIImageView * background = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 55)];
UIImage * image = [UIImage animatedImageNamed:#"MovingCar" duration:3.6];
background.image = image;
[self.view setBackgroundView: background];
You can change the duration to suit your needs accordingly.
You could use the UIView method animateWithDuration:animations: or one of it's variants that has a completion method to animate images from the top to the bottom of the screen. Take a look at the Xcode docs on that method, and search the web for examples.
As the other poster says, this site is for helping people with problems, not for asking others to provide you with ready-made solutions.
I could bang out some animation code for you that would create an endless stream of falling raindrops, but it would probably take me a couple of hours to get it fully working, and I'd have to charge you for it. (Plus I'm not very familiar with Swift so I'd have to do some translation from Objective-C, which is my day-to-day programming language.)