swift - navigation controller remove back button arrow

I have an application in swift, where the view controllers are inbedded in a navigation controller, now in the 2nd and 3rd viewcontroller, on the back button, there is a blue arrow pointing backwards (it is there by default). I have tried to remove this, but when I want to have an image there, the image gets all squished up. Does anyone know how you would go about removing the back-button arrow, and replace it with an image? Thanks alot!


Use this line....

Set Text:

let backBtn = UIBarButtonItem(title: "Back", style: UIBarButtonItemStyle.Plain, target: self, action: "BtnTapBack:")
navigationItem.leftBarButtonItem = backBtn
navigationItem.leftBarButtonItem?.setTitleTextAttributes([NSFontAttributeName: UIFont(name: "YourFontName", size: 20)!], forState: UIControlState.Normal)

Set Image:

let image = UIImage(named:"YourImageName") as UIImage!
var btnBack:UIButton = UIButton.buttonWithType(UIButtonType.Custom) as! UIButton
btnBack.addTarget(self, action: "BtnTapBack:", forControlEvents: UIControlEvents.TouchUpInside)
btnBack.setImage(image, forState: UIControlState.Normal)
btnBack.setTitleColor(UIColor.blueColor(), forState: UIControlState.Normal)
var myCustomBackButtonItem:UIBarButtonItem = UIBarButtonItem(customView: btnBack)
self.navigationItem.leftBarButtonItem  = myCustomBackButtonItem

Action go to the previous viewcontroller

@IBAction func BtnTapBack(sender: UIButton) {

Need Your Help

File uploads with Gears & PHP

php javascript file-upload google-gears gears

We provide the ability to submit images to a user's gallery.

Why won't Xcode 4.2 support a second-generation iPod Touch, running iOS 4.2.1

iphone xcode4.2 ios-4.2

I recently upgraded to Xcode 4.2, for SDK 5.0 support, but since I've done so, one of my testers, who has an iPod Touch 2nd generation running iOS 4.2.1, can't use my ad-hocs

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.