Sunday, February 03, 2013

Use an image as your UIBarButtonItem

Using an image as your UIBarButtonItem in your navigationcontroller bar can only be achieved by using a common UIButton as the BarButtonItem's custom view.

This is an example on how you can achieve that. It takes a target, selector and image name and returns a UIBarButtonItem as an image.

+(UIBarButtonItem*) getBarButton:(id)target withSelector:(SEL)selector andImage:(NSString*)imageName
{
    //Create image
    UIImage *image = [UIImage imageNamed:imageName];
    
    //Create UIButton with the imag
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.bounds = CGRectMake(0, 0, image.size.width, image.size.height);
    [button setImage:image forState:UIControlStateNormal];
    [button addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];

    //Create UIBarButtonItem with customview button
    UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithCustomView:button];
    
    return barButton;
}

36 comments:

tom said...

nice

essaykings.co.uk said...

This proved out to be extremely useful in terms of home assignment at the university! I like the idea of your blog very much!

kevin antony said...

I appreciate your efforts because it conveys the message of what you are trying to say. It's a great skill to make even the person who doesn't know about the subject could able to understand the subject . Your blogs are understandable and also elaborately described. I hope to read more and more interesting articles from your blog. All the best.


rpa Training in annanagar

blue prism Training in annanagar

automation anywhere Training in annanagar

iot Training in annanagar

rpa Training in marathahalli

blue prism Training in marathahalli

automation anywhere Training in marathahalli

blue prism training in jayanagar

automation anywhere training in jayanagar

Pankaj Singh said...

Thank you much for this tutorial; this is informative and valuable blog. Visit for
Europe Honeymoon Packages

Unknown said...

Very nice post.
buy tops for girls

https://amantoothtown.blogspot.com/ said...

Great..thanks for sharing this information..
dentist in vasant kunj

RPA Automation Anywhere Online Training said...

Great Site, The Course were so simple and easy to understand.
RPA Automation Anywhere Training
RPA Automation Anywhere Online Training

service care said...

Superb.. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing post.
redmi service center
mi service center
redmi service center near me

مروة محمد said...

شركة تسليك مجاري بالدمام



شركة كشف تسرب المياه ببريدة




التخلص من رائحة الحمام بالخبر

spot said...

Nice information keep sharing with us. Please check out web developer also. I hope it will help you.

Unknown said...

agar aapka husband aapse ladai karta hai or aap karna nhi chatey toh aap jarur apne pati ko apne vash main kar sakty ho पति को वश में करने के टोटके kare

al ghadeer said...

شركة تنظيف مكيفات بالرياض
شركة تنظيف مكيفات شمال الرياض
شركة تنظيف مكيفات
شركة تنظيف مكيفات غرب الرياض
شركة تنظيف مكيفات بالخرج
شركة تنظيف مكيفات بالدمام
شركة تنظيف مكيفات بالخبر
فنى صيانة مكيفات سبليت بالرياض
نتيجة الثانوية العامة 2019

_______

shivam said...

Flying Shift - Packers & Movers in Bhopal

tech news said...

Everything is very open with a clear explanation of the issues. It was definitely informative. Your site is very helpful. Many thanks for sharing!
Gadgets

Pankaj Singh said...

Ogen Infosystem is a leading website designing company in Delhi, India. Here you will get the experienced website designers and developers.
Web Design Company

Anong Busarakham said...

I cannot thank Mr Benjamin service enough and letting people know how grateful I am for all the assistance that you and your team staff have provided and I look forward to recommending friends and family should they need financial advice or assistance @ 1,9% Rate for Business Loan .Via Contact : .  lfdsloans@outlook.com. WhatsApp...+ 19893943740. Keep up the great work.
Thanks, Busarakham.

keerthana said...

it's very supr information

PHP Training in Chennai | Certification | Online Training Course | Machine Learning Training in Chennai | Certification | Online Training Course | iOT Training in Chennai | Certification | Online Training Course | Blockchain Training in Chennai | Certification | Online Training Course | Open Stack Training in Chennai |
Certification | Online Training Course


Jayalakshmi said...

I would really like to read some personal experiences like the way, you've explained through the above article.
hardware and networking training in chennai

hardware and networking training in tambaram

xamarin training in chennai

xamarin training in tambaram

ios training in chennai

ios training in tambaram

iot training in chennai

iot training in tambaram

deiva said...

Thank you much for this tutorial; this is informative and valuable blog.
web designing training in chennai

web designing training in omr

digital marketing training in chennai

digital marketing training in omr

rpa training in chennai

rpa training in omr

tally training in chennai

tally training in omr

praveen said...

Nice blog with new information,
Thanks to share with us,

cyber security course in chennai

cyber security course in porur

ethical hacking course in chennai

ethical hacking course in porur

shiny said...

Thank you for these back links because they have been extremely useful in my link building........

hardware and networking training in chennai

hardware and networking training in annanagar

xamarin training in chennai

xamarin training in annanagar

ios training in chennai

ios training in annanagar

iot training in chennai

iot training in annanagar

jeni said...

It¦s truly a nice and helpful piece of info. I am satisfied that you simply shared this helpful information with us. Please keep us informed like this. Thanks for sharing.
hardware and networking training in chennai

hardware and networking training in velachery

xamarin training in chennai

xamarin training in velachery

ios training in chennai

ios training in velachery

iot training in chennai

iot training in velachery

tejaswini said...

You really make it look so natural with your exhibition however I see this issue as really something which I figure I could never understand. It appears to be excessively entangled and incredibly expansive for me.https://360digitmg.com/course/certification-program-in-data-science

360digitmgdelhi said...

informative blog...!
artificial intelligence course in delhi

vivekvedha said...

Superb.. Really it is an amazing article I had ever read. I hope it will help a lot for all.
acte reviews

acte velachery reviews

acte tambaram reviews

acte anna nagar reviews

acte porur reviews

acte omr reviews

acte chennai reviews

acte student reviews

rocky said...

Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
python training in bangalore

python training in hyderabad

python online training

python training

python flask training

python flask online training

python training in coimbatore

360DigiTMG said...

This is a great post I saw thanks to sharing. I really want to hope that you will continue to share great posts in the future.
hrdf contribution

pavi said...

Am really impressed about this blog because this blog is very easy to learn and understand clearly.This blog is very useful for the college students and researchers to take a good notes in good manner,I gained many unknown information.


Data Science Training In Chennai

Data Science Online Training In Chennai

Data Science Training In Bangalore

Data Science Training In Hyderabad

Data Science Training In Coimbatore

Data Science Training

Data Science Online Training

Ramya said...

Thanks for provide great informatics and looking beautiful blog, really nice required information & the things i never imagined and i would request, wright more blog and blog post like that for us. Thanks you
DevOps Training in Chennai

DevOps Online Training in Chennai

DevOps Training in Bangalore

DevOps Training in Hyderabad

DevOps Training in Coimbatore

DevOps Training

DevOps Online Training

Ramya said...

Thanks for provide great informatics and looking beautiful blog, really nice required information & the things i never imagined and i would request, wright more blog and blog post like that for us. Thanks you
DevOps Training in Chennai

DevOps Online Training in Chennai

DevOps Training in Bangalore

DevOps Training in Hyderabad

DevOps Training in Coimbatore

DevOps Training

DevOps Online Training

ai courses said...

I need to communicate my deference of your composing aptitude and capacity to make perusers read from the earliest starting point as far as possible. I might want to peruse more up to date presents and on share my musings with you.

https://360digitmg.com/course/artificial-intelligence-ai-and-deep-learning

sharath said...

A very nice guide. I will definitely follow these tips. Thank you for sharing such detailed article. I am learning a lot from you.
Java Training in Chennai

Java Training in Bangalore

Java Training in Hyderabad

Java Training
Java Training in Coimbatore


ajith said...

thank you for the information

angular js course in chennai

angular course in chennai

angular js online course in chennai

angular js course in bangalore

angular js course in hyderabad

angular js course in coimbatore

angular js course

angular js online course

dataanalyticscourse said...

I have a strategic I'm seconds ago chipping away at, and I have been at the post for such data
360DigiTMG data analytics course

Mohd Sharique said...

I genuinely appreciated understanding it. Sitting tight for some more incredible articles like this from you in the nearing days.

data science course near me
data science online training

hrdf claimable said...


This is a great post I saw thanks to sharing. I really want to hope that you will continue to share great posts in the future.

hrdf claimable

Use an image as your UIBarButtonItem

Using an image as your UIBarButtonItem in your navigationcontroller bar can only be achieved by using a common UIButton as the BarButtonItem...