Archive

Posts Tagged ‘apple’

iPhone – Set or change title of UIBarButtonItem

October 29, 2009 Gaurav Sohoni Leave a comment

Now this is very trivial and does not need a lot of work. I had googled for this but got some not so good answers so I tried out something and it works fine.

So basically what we are trying to achieve here is:

1) First create a UIBarButtonItem and put it in navigation.

2) Changing the title of the BarButtonItem on tap.

We do this by first declaring the button (in this case, the title is ‘Edit’) and attach a function to it which basically does something and also changes the Button Label to ‘Done’.

So lets first add the button on view load:


self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Edit" style:UIBarButtonItemStyleBordered target:self action:@selector(alterMode) ];

So the action ‘alterMode’ is now attached with the rightBarButtonItem. Now we just need our altermode method to change the title of the button and we are done.


-(void) alterMode {
  if(self.navigationItem.rightBarButtonItem.title == @"Edit") {
    //Do your stuff;
    self.navigationItem.rightBarButtonItem.title = @"Done";
  }
  else{
    //Do your stuff;
    self.navigationItem.rightBarButtonItem.title = @"Edit";
  }
}

That is all you need to do. Try it out. Hope it helps someone out there.

iPhone: TextField custom textDidChange action

August 27, 2009 Gaurav Sohoni 2 comments

While working on a project, I came across a requirement where I was required to fire an action on textfield text change. I did not find any method that apple provides like it does for searchbar text change. With some research on google, I went ahead and created a custom method which was then added on textfield event change namely UICOntrolEventEditingChanged.

This was what I did to make it work.

In ViewDidLoad, I added the following code:


[myTextfield addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UICOntrolEventEditingChanged];

Here I am attaching ‘textFieldDidChange’ method which will be called once the text in the myTextfield changes. I named it like this to make it sound more like the method for searchbar textchange method.

The actual method is:

-(void)textFieldDidChange {
// whatever you wanted to do
someLabel.text = myTextfield.text;
}

Leopard is out…

November 6, 2007 Gaurav Sohoni Leave a comment

Leopard is out…

This one is not from the jungle but from Apple. The latest OS / OSX release has been
labelled LEOPARD. Leopard was always in the news as it was scheduled to be released
with 300 new features and now that it has been released, all these new enhancements / features
are available for you. Check it out on www.apple.com

The new release is obviously feature packed. The major features fall under these categories:

1. Universal Access
2. Mail
3. Preview
4. System
5. iChat
6. DVD Player
7. BootCamp
8. Finder
9. Time Machine
10.SpotLight

Other categories include Graphics and Media, Parental Control, Terminal, Dashcode, iCal and many more.

Universal Access – They have added anew voice. They call it Alex. Support for drag and drop using keyboard, added Braille panel, faster web and Page navigation and many other features.

Mail – Stationery added, forward email as attachment (already there in other OSes), photo browser, improved search, rich formatting.

Preview – Personalized annotations, improved color adjustment, PDF manipulation, Batch Image Operations, auto levels for Image manipulation.

System – Live Partition Resizing, Help Menu search (new search field in Help menu), Grammar check, Empty trash button, Eject all partitions (USB / FireWire).

iChat – PhotoBooth (apply effects to fotoz), backdrop effects, screen sharing, custom buddy list order, tabbed chat, SMS forwarding, File transfer manager, recording.

DVD Player – Auto zoom, floats above other apps, chapter thumbnails, parental control, time slider

BootCamp – Run XP & Vista @ native speed, assistant, copy files between XP and Mac, easy restore, convenient boot camp shortcut

Finder – Cover Flow – lets you flip thu ur files and shows the first page, connect Mac from anywhere, Instant screen sharing, bar for path, folder sharing.

Time Machine – Automatic Backup, Shows the various versions in a time wise manner, allows for manual backup too, preserves privileges, lets you browse other disks vreated with time machine.

SpotLight – Dictionary n calculations in spotLight, lets you search web history, searches by filename and searches system files too.

These are some features that have been released with the new Mac OSXLEOPARD.

And the price is:
Single user – $129
Family Pack – $199

Datz all 4 d time being….