Modifying MWPhotoBrowser in iPhone - iphone

Hi I am have added the MWPhotoBrowser in my iPhone application it works great but now i need to add a little more functionality to my photo gallery.
basically what to do a couple things:
add a button to the navigation bar
decrease the space between two images.
However I don't know how to approach this problem.. should I subclass the Photo Browser or should I make changes in the Photo Browser's source code.
P.S. i tried to modify the code directly in MWPhotoBrowser.h file which didn't work. No changes were made. I'm super new to iPhone programming so i don't have much idea what is going on. Any help would be greatly appreciated. I know its a noobish question so please go easy on down votes :)

In the MWPhotoBrowser.m file find the setNavBarAppearance method and add this
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self action:#selector(someAction)]; // This can be changed to your liking
self.navigationItem.rightBarButtonItem = rightButton;
[rightButton release];

Set the Padding : 10 to 0;
Its done.
Thnaks

Related

specially indicating or highlighting a toolbar button when a note is added in iphone

In my app i have an option for adding notes to particular tips.the button for adding notes is at the top.So i want to highlight that particular button when a notes is added.If a Tip has a note attached the notes icon should light up / glow (somehow look different), so that it can quickly identify this tip has a note attached.How can i implement this one.Is it possible.Can any one Please help me.Thanks in advance
We used some special button in tool bar in an application. We make it following way.
UIButton* btnInfo = [UIButton buttonWithType:UIButtonTypeInfoLight];
[btnInfo addTarget:self action:#selector(verInfoBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *modalButton = [[UIBarButtonItem alloc] initWithCustomView:btnInfo];
Here main point is to use [[UIBarButtonItem alloc] initWithCustomView:btnInfo]; method.
Check if it can be helpful...

iPhone/iPad: how to change location of home or cancel or any buttons in UINavigationController (with or without InterfaceBuilder)

My question is fairly straightforward and simple.
I have seen code that implements a button (such as a cancel button) that can be added to a UINavigationController. Code looks like this:
UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc]
initWithImage: [UIImage imageNamed:#"home.png"]
style: UIBarButtonItemStylePlain target: self
action: #selector(cancel:)];
self.navigationItem.rightBarButtonItem = cancelButton;
[cancelButton release];
What I'd like to do is to place these buttons in a custom location in the navigationItem...not in the default rightBarButtonItem or leftBarButtonItem location, but controllable perhaps using x and y co-ordinates...is this even possible? It seems like a simple request, but google searching and documentation reviewing is driving me a little nuts :)
I would appreciate any assistance with this issue.
thanks again,
Edward
I agree with 'Hack Saw' in the case of it being against the Apple 'Human Interface Guide' and thus not recommended...However... If you want to, you can draw additional views into the navigation bar's title view [self.navigationContoller.navigationBar.topItem setTitleView]. Hope that helps!
Here is link to reference: UINavigationItem
They don't make that easy because it would break user expectation. I recommend against it. If you have a serious need for it, you'll probably need to make your own navbar.

UIBarButtonItem image with the "creation" button

I'm new to the iPhone SDK and I wonder, where I get some standard buttons, that a lot of applications use. I wanted to have that button:
http://4.bp.blogspot.com/_fAv06gZ6FPU/SumCCleuwpI/AAAAAAAAAFs/0mtPapm8EFg/s1600-h/Screen+shot+2009-10-29+at+11.47.20.png
in an UIToolbar. Any advices please? :-)
Thanks in advance...
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:myTarget action:mySelector];

How to add refresh button to iPhone RSS Reader app?

I'm playing around with this application I got on last months Web Designer that's a very basic RSS reader. I would like to add a refresh button to the top navigation bar that refreshes all the content in the table but can't seem to work out how to do it. I've worked out it must somehow use the [tablename Reload] function, but have got no idea how to implement it.
I'm new to all this so simple instructions are good instructions :) I know how to add the button, its linking it to and defining the actions when the user clicks it that I'm struggling with.
You can grab the code here http://www.webdesignermag.co.uk/tutorial-files/issue-162-tutorial-files/ under iPhone Apps (it's the only one).
This is what you need to do in the RootViewController.m:
In the viewDidLoad function, add a button of type UIBarButtonSystemItemRefresh, associate to it an Action and a Target, (infact, as Alan told you, you need to learn about Outlets and Actions)
UIBarButtonItem *refreshButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:#selector(refreshTable)];
self.navigationItem.rightBarButtonItem = refreshButton;
Implement refreshTable function (if not declared in .h, have to put it above viewDidLoad())
- (void)refreshTable{
[rssParser release];
rssParser = [[RSSXMLParser alloc] init];
[rssParser parseRSSFeed];
[self.tableView reloadData];
NSLog(#"table is refreshing ....");
}
Hi Graeme and velcome to SO.
For the iphone UI, you have to define outlets and actions, and use Interface Builder to link them together.
This page has some information that should hopefully get you started.
Understanding Outlets and Actions

iPhone app Action Button

I need to add an action button in my iPhone application. When that one is clicked the UIActionSheet with buttons need to be popped up.
Can any one tell me how to add an action button? - means is there any in built action button for iPhone app? or do we need to create a new button with image?
Thanks in advance!
Assuming this is in a view controller, you can do something like:
- (void)viewDidLoad
{
UIBarButtonItem *actionButton = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemAction
target:self
action:#selector(methodThatShowsSheet)];
self.navigationItem.rightBarButtonItem = actionButton;
[actionButton release];
}
(Pardon the weird indentation to make it fit in a reasonable width (I normally just let Xcode wrap-indent everything automatically)).
See Nick Veys' answer for how to implement methodThatShowsSheet.
You need to hook up the action from the button you've decided will present this action sheet to code that shows it.
See the Apple Documentation on UIActionSheet for help on doing that.
I'm not sure I understnd your question but UIKit includes the UIButton class which will automatically send a message (specified by you) to an object (also specified by you). You can create a UIButton i nInterface builder or programatically.
Without more details on whay you actually want to do or why you're finding it difficult,m it's difficult to be more precise.