Round Rect UIBarButton in iOS 7 - ios

I Am trying to create a UIBarButton as a flat Round Rect. sort of a mix between iOS 7 and 6.
Heres an example from the Facebook app
I want a Button that looks like the "send" button.
Anyone has any idea?
Im actually surprised that Apple don't give this option for us while they use it in quite a few places. sometimes just writing in colour is not enough to make the user understand its a button.

If you were to put a UIButton inside a UIBarButtonItem and set the backgroundColor, then you could use the cornerRadius property of it's layer:
self.button.layer.cornerRadius = 5;
In order for this to work, you need the CoreGraphics.framework and #import <QuartzCore/QuartzCore.h>

You can just provide a custom button background image with rounded corners and set it as the background image inside the storyboard.

Related

UIButton over an UIImageView via storyboard

I want to create my view as below:
For which i have figured out i need an UIImageView to display the default profile pic and a UIButton with an image of camera over the UIImageView. I added an UIButton over the UIImageView, but when i run my code it is not visible. I tried changing the background color and added some text on the UIButton but the UIButton is not displayed. I have already gone through similar questions but most of them were solved by adding the code for UIButton and UIImageView and not via storyboard. Can someone point out where i am going wrong.
Also any other suggestions to make similar view are appreciated. The one i can think of is to use and UIImageView instead of UIButton and enable it's user interaction. But that isn't much different than using UIButton.
Thank you.
Try below line of code :
[btn.superView bringSubViewToFront :btn];
Write above line of code at the end of - (void)viewWillAppear:(BOOL)animated mathod.
Try to drag the button from the document outline as it comes after the ImageView. Check the images given.
Check in document outline in storyboard and check view's stack.button should be above imageView(below in document outline). if not then change position by simple drag and drop. Hope this will help :)

Swift - ios - creating ballon buttons

I want to create a set of buttons that will look like this:
(The selected buttons are those with a different background)
Any ideas for a simple implementation?
Are there any known open source implementations for this?
Thanks!
Following is the library which may be use to solve your problem,
For different appearance you need to give the conditional code for that but with out that your problem may solve with this library or code.
You can download the sample code of RRTagController project here.
For rounded corners use UIButton.layer.cornerRadius. if you set corner radius to half of the box you will get circle. For the border color use layer.borderColor = UIColor.redColor().CGColor.
For the background color of the button you can keep track with selected state of the button. Here is an example of using selected state: UIButton state selected
Next thing you could do is to keep data about selected ones, since the best way to do something like this would be UITableView - seems like every row of buttons have same height, and if you want to send that somewhere you can keep track about what items are selected.
I think the best way is to use UICollectionView.

How can I increase/decrease the brightness of the image in iOS?

I've an image , I want to increase/decrease its brightness by using a UISlider? How can I do it?
Is there any default method are available for this? If yes, please tell me..
Thanks!
If you don't want to use the link and want to code a custom solution try this:
In your Storyboard add an imageView with the image
Add a view that has a white background color
Add a view with a black background color
Add a slider and make sure they aren't in each others views!
Now use CNTRL + click to create your properties in the .M file
Create the method for the slider by CNTRL + clicking below the viewDidLoad method and name the method something like sliderChanged:
Change (id)sender to (UISlider *)sender
Last thing to do, fill the method body with this!
these are screenshots from the custom brightness app you just made:

Add icon to SBSearchTableViewCell

I am trying to add an icon to a SBSearchTableViewCell.
I was adding a subview on top of the cell but that still left a border, and the text was underneath the icon.
http://i.imgur.com/tGqWaEa.png
I tried hooking into -[SBSearchModel _imageForDomain:andDisplayID:] but the domain is 0 and the displayID is (null).
Code: http://pastebin.ca/2460380
Resources:
http://theiostream.tumblr.com/post/54339870761/hacking-the-ios-spotlight-v2
https://github.com/theiostream/SearchLoader
Did you try to set image using -(void)setTitleImage:(id)image animated:(BOOL)animated; method (I'm not sure what it does, but that is the only method to set image in the cell you are using...)? And, How about just creating your own labels, and place them on the right places? That should not be that hard, I think. Good Luck!
EDIT
Sorry it seems like the method I mentioned is available only on iOS 7 and higher. I suggest you to use you own UILabels and UIImageView with imitation to the original.
ANOTHER EDIT
It looks like the SBSearchTableViewCell is the subclass of the UITableViewCell, so why don't you use the it's imageView property to set the image (or, icon) to the cell?
You can move the border over by setting cell.sectionHeaderWidth. Then you can add a subview like you already have done.

How do I make UITextview like Facebook comment view?

I want to make UITextview like in the Facebook comment view. How can I do it without using any external libraries?
Here is example image:
First, set the appearance of your UITextField to Alert to get the black keyboard.
Then, you only need two more views :
a black one for the background
a white one which will be the background of your text field, which you programmatically apply the following code to (don't forget to #import <QuartzCore/QuartzCore.h> first):
view.layer.cornerRadius = 10;
i have get sample code for this - here it is YIPopupTextView
What they do is use an image, that's it! They also probably expand the size of the UITextfield to make it fit the entire screen but yeah it's pretty easy. If you go into Interface Builder you can see a thing that says image. If you want to do this programmatically there is a value is textfield.background (A UIImage).
If you don't want to create an image you can create a custom UITextField subclass and use the -(void) drawInRect:(CGRect)rect function, and draw it with Quartz, and in interface builder set the UITextField class to your textfield.

Resources