I want to add a little flair to my application and while I have been somewhat successful, I haven't figured out a way to truly do what I want to do. I would try to subclass UITabViewController, but I don't think I would even know where to start or if that is the right approach.
Basically, what I want to do is have custom images for each tab bar button. I have both pressed and non-pressed images. Instead of using the highlight that is generated over the current icon, I want the pressed image to be shown. What I've been able to do is create a Category of the UITabBar with a custom drawRect method that basically draws all of my custom tab bar icons. I then initialize the same amount of UITabBarItems w/out specifying an image or title of any kind which I then add to the array of items. This lets me have my icons and then just overlays the highlight on them.
This is ok I guess, but I would really like to have the pressed button look.
Here is the code I use for drawing the tab bar:
#implementation UITabBar (CustomImage)
-(void)drawRect:(CGRect)rect
{
UIImage *image = [UIImage imageNamed:#"TabBar.png"];
[image drawInRect:CGRectMake(0,0,320,50)];
}
#end
And then I initialize the tab bar items like this:
UITabBarItem *homeTabBarItem = [[UITabBarItem alloc] init];
If anyone knows how I would do this, that would be greatly appreciated. Please keep in mind that I'm still relatively new to Objective-C, so I'm somewhat confused as to how I would correctly subclass anything at this point.
The functionality I'm looking for would be similar to what RougeSheep was able to accomplish with Postage: http://postage.roguesheep.com/ They did an awesome job, and this is kind of what I'd like to emulate.
Related
Safari has a nice popover that is used for controlling the font size. I'm talking about that one:
It's pretty nice, and my question is - how to implement something exactly like this?
Thank you!
There are many projects in github about popoverview, such as this https://github.com/takashisite/TSPopover
One way to implement this is to add a transparent view that takes up the whole screen so that when I touch outside the popover content, it'll dismiss. And the rest you need to do is just add some subviews to your transparent view.
Simple Really, If you want to use a popover then you can see this code PopOver Link
Or you can simply create a UIView containing 2 buttons , let this UIView rollout an animation whenever the UIButton on the bar is clicked and so on and so forth. Let me know for further queries :)
How to add image to lower bar in tab based application
I can get the
self.navigationitem
but how to access the lower toolbar anda add background image to it
best regards
What you're looking for is a UITabBarITem that you can obtain from the items property of a UITabBar, or more easily from the tabBarItem property of your UIViewController.
Then I guess you can set your image using image property...
In conclusion :
self.tabBarItem.image = [UIImage imageNamed:#"myBeautifulImage.png"];
might be what you're looking for (self being, ofc, your UIViewController)...
EDIT: but if your "lower bar in tab based application" is a UIToolbar (/me :grins:..) then what you are looking for is a standard UIBarButtonItem that can be obtained from UIToolbar.items property OR some IBOutlet property if you wired it using Interface Builder.
In any case, I guess looking at Apple sample codes might be a good idea.
i need to place one textfield with 3 buttons in an alertview. According to UIGuidelines it is not possible,so Instead of AlertView I place UIView similar to Alertview.
And i animate it like Alert view using this code.
If works fine.
it displays with white Color Background,But i need to design same as AlertView Background color and style like round edged.
How can i done this.
can anyone pls help me.
Thank u in advance.
The UIAlertView background is simply an image. You are better off creating a custom png image and using it as your background.
That can be done with CoreGraphics / Quartz functions, but it is quite complicate to simulate the same effect
Another approach would be to create a UIImageView with a streched uiimage you mock in Photoshop or so.
;)
EDIT: You can set a custom view directly into UIAlertView like this:
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) {
[_addPersonAlert setValue:auxContainerView forKey:#"accessoryView"];
}else{
[_addPersonAlert addSubview:auxContainerView];
}
There are a lot of open source, subclasses of UIAlertView that might accomplish what you want to do. I'll leave a couple as an example but you can certainly google out some other options as well.
https://github.com/rtecson/RTAlertView
https://github.com/lmcd/LMAlertView
In my case I used once, LMAlertView which let's you access it's "contentView" property, to set any UIView that you want as part of the alert. Have in mind that you can add a hierarchy of views into a single UIView and set this container view as the contentView of the alert.
Just like the tabbar, I want to show badge on UISegmentedControl. As I cant see any predefined methods for UISegmentedControl just like available for UITabBar.
I thought about adding the badge as an image just on top of it, but maybe there is some better way.
Here is a little third party library I've used to draw badges on various things. It's pretty nice. For example, changing the color of the badge to match my design was trivial.
Once you bring this class into your project and include it into your view controller, you go:
CustomBadge *customBadge1 = [CustomBadge customBadgeWithString:#"Badge 1"];
...and then add customBadge1 as a subview of whatever thing you're badging.
I had this problem today, so I've put together a UISegmentedControl subclass which allows you to easily set badge numbers on each of the segments.
Using it's as easy as:
[segmentedControl setBadgeNumber:1 forSegmentAtIndex:0];
Screenshot, documentation and source code are at https://github.com/dave-thompson/MESegmentedControl .
There is no badge property or method - unlike the tab bar. If you want to do this you will just have to put a custom image over it. You could subclass the segmented control and create a function that does this for you.
This may be a simple question but i would like some help to find out how to make it.
I want to make a custom "loading" popup for my ipad app.
Just like this app:
http://www.youtube.com/watch?v=ZY31Bn5slv0
you see the black loading popup at +- 30sec,40sec,56sec,...
I remember that i had a sample of this, but can't find it back.
Can someone show me which way to look?
Thanks
This is exactly what you want.
After adopting this,
in initWithFrame: mehode of Loadingview create a frame with CGRectMake(0,0,300,300) then make it center loadingView.center = aSuperView.center;
and inside the drawRect: methode set ROUND_RECT_CORNER_RADIUS = 20;
looks like a UIView with curved corners a UIActivityIndicator and a UILabel saying "loading".