Customizing the post to facebook in Sharekit2.0 - objective-c

I have integrated the latest sharekit code into my project. I am able to click in, to go to the facebook and able to see the text I am going to post.
I would like to change two things.
Firstly, I am not able to see the cancel or post button because of my app picture at top. So I would like to set the view to be scrollable. How do I change that?
Secondly, I would like to remove the keyboard after I press return, or I want a way to remove the keyboard.
Thirdly, when i click the text edit, it gives me Error: HTTP status code: 404. How to solve this?
Need some help on this..Thanks..

if you use following code it will dissmiss the keyboard.
[self.view Endediting:YES];

ShareKit never seemed to be customizable. Personally, I had displeasure to integrate it into the project to post images to Flickr and Twitter, but nothing else. For what I see there now, ShareKit is still using old FacebookSDK (or at least it look so).
For better customization, I'd suggest to throw away Facebook from your ShareKit and just use new FacebookSDK.

[yourtextview resignFirstResponder];
this will remove the keyboard
Or as a general case, you can use this: [self.view Endediting:YES];

Related

Button does not react

I have a strange behaviour with an NSButton. It works normal until I do so voodoo somewhere else in my app. Right then the button does no longer react on click events. It still looks normal (so not disabled). It just does not do anything when I click it. Any idea where I should look in the properties of NSButton that might have been changed accidentally? (Quite sure I did not touch the button itself.)
Ensure your button is in a 'touchable' zone in its superView. I mean It have ro be placed inside it superView bounds (If not, you can see It, depending on Clipping properties, and you can't interact with It). In order to check it, set a color to your container view.
Also check userInteraction is enabled...
Hope It helps.
If your button is just not giving the animation, it might be an Xcode bug. I had a similar problem before, and I filed a bug, and it got fixed on the next Xcode version. Check out my SO question. Toolbar bar button item not working properly in SplitViewController
If you really need to give it an animation, you could probably do it in code with something like this. Please note that this is untested so it may not work, or you might need some fixing, but you get the idea :)
- (IBAction)buttonAction:(id)sender {
self.button.titleLabel.textColor = [UIColor lightGrayColor];
// Action
self.button.titleLabel.textColor = [UIColor darkTextColor];
// Or with delay
[self performSelector:#selector(changeButtonColor) withObject:nil afterDelay:0.1];
}
I figured it out. The button opened a transient popover. In order to close this popover due to an action I had coded
view.window!.orderOut(self)
After replacing it by
view.window!.performClose(self)
the strange effect was gone. I'm not sure, but this looks like a bug in the Swift runtime. I'll report it and see what comes out.

Is there any way to highlight the status bar item programmatically?

I'd like to perform the following:
when I click on the status bar item (NSStatusItem) I want to highlight it (no menu) indefinitely and when the application loses focus I want to stop highlighting it.
Is there any way of doing this? I can't find it, tbh.
You can probably do this with a custom view that sends the status item a drawStatusBarBackgroundInRect:withHighlight: message.
I doubt there's any way to do it without a custom view, since, as I mentioned in my comment on the question, keeping the item highlighted when the user doesn't have the mouse down on it looks bad.
Old question, but I think it is worth adding this alternative answer.
This will not automatically un-highlight when the application loses focus, but this allows you to highlight without using a custom view (as the other answer requires):
NSStatusItem *statusItem = [self getStatusItem];
[statusItem.button setHighlighted:YES];
You can unhighlight it manually using the same method:
[statusItem.button setHighlighted:NO];
Note I got this answer from a similar question here.

How to create a custom NSMenuItem

Well, I have quite a basic question which I can't seem to find an answer to. I followed this guide to create a StatusBar menu, which works great...
However, I would like to add a custom NSMenuItem containing custom stuff. As example such as the sound slider, or the switch user account row ect.
How can I do that?
Even links to tutorials are welcome.
In most cases, you'll create a custom view containing the slider or whatever else you want to appear in the menu item. Then you call setView: on the NSMenuItem in question.
For more details, check this article from Apple's documentation:
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MenuList/Articles/ViewsInMenuItems.html
Just use the setView: method of NSMenuItem.

XCode 4. Keyboard doesn't hide on iPad

I have a problem with my iPad app.
I perform authorization in social networks (facebook, twitter etc.) to post information from app. Several webviews change each other (login, content of post, captcha). They have text fields and I have to show keyboard. After posting I return to some start view with posted information.
It works good, but after posting first news something goes wrong. When I post news one more time, after return keyboard is still on the screen.
I saw here some questions familiar to this, but they wasn't useful.
I tried to make resignFirstRersponder to all webViews, textFields and textViews. Also i\I tried to implement method disablesAutomaticKeyboardDismissal but it doesn't help me.
I don't know where search for problem...
So questions are: why could this happened? How can I solve this? fnd How can I get some information about keyboard? (is it visible, what object has focus etc., anything that could be useful to solve problem)
And one more thing. I have similar app for iPhone and it seems to work correct.
Try this:
[searchBar performSelector:#selector(resignFirstResponder) withObject:nil afterDelay:0.1];
Make sure to replace searchBar with the object that is the actual First responder in your case
Problem is fixed, finally. The reason was the way I had changed visible view. I set a new value to view property of ViewController. And as previous view contains text field with focus on it, focus wasn't lost before changing view (and keyboard was still on the screen), but I had lost handler to previous view.
Solution is: resignFirstResponder to all (or current) inputs BEFORE changing view.
Hope, it's clear. Thanks for your help!

how to add custom keyboard

I did a simple application.
My application contains 10 Text fields.
what i need is i need to hide default keypad i place manual keys like this
How can i done this keys works as a keypad to my app.
can any one pls post some code or link.
Thank u in advance.
I wrote a KeyPad, that is easy to customize via its delegate.
Just add a view with 10 buttons and assign action for each of them.
In the didBeginEditing method diss the keyboard using,
[textField resignFirstResponder]
[yourKeyboard show];
And i think apple will reject the applications using custom keyboard
There is a complete thread about that here
It has a tutorial, lots of comments, sample code and project, everything you need is there. (Is quite long though)
You basically create a view with your buttons for example and
In iOS3.2 and above you can use inputView property of your textField.
In early iOS versions you have to do a trick (add your keyboard as a subview of UIKeyboard) that is also written in the link.
If you need more advanced stuff than simple numbers, you probably want to look at UIKeyInput and UITextInput protocols.
Hope it helps