UIActivityViewController customisation - ios

My requirement is to add a label to UIActivityViewController and remove cancel button. Also I want to remove items separator. How can I achieve this. Also, I am not sure if this is the right way. I have created subclass of UIActivityViewController as under:
#interface SampleActivityViewController : UIActivityViewController
#end

Well you have to create your own custom UIActivity
Have a look at this.
You can also have a look at this project on github, basically is a collection of custom UIActivity for the most common services Instagram included.

Related

Creating text field in iOS Sharing extension

I'm working on a sharing extension in iOS with Swift. In the share app, I would like to add a custom field, where the user can add text to it. I tried finding references to see how it could be done but I can't find any.
Can someone help me out please?
You can't magically make a text field appear in the SLComposeServiceViewController interface. So you have two choices:
Use SLComposeServiceViewController, and add a configuration item (SLComposeSheetConfigurationItem) which you've set up so that it pushes some new interface containing a text field.
The pushed interface is up to you, even though the SLComposeServiceViewController interface is not.
Don't use SLComposeServiceViewController in the first place. Now the whole interface is up to you. Just use a normal view controller and it will be presented for you, and you can design the view in the storyboard just like always.

Is there a way to "capture" all the UIButton taps inside an app?

I want to be able to track what buttons my users are tapping.
Is there a way to "capture" or "log" all the button taps inside my app?
I was thinking about method swizzling but I really rather not get into that.
Aspect Programming may help you. Have a look at this library :
https://github.com/steipete/Aspects
Basically you do something like :
[UIButton aspect_hookSelector:#selector(whateverSelectorYouWantToHookOn:)
withOptions:AspectPositionAfter
usingBlock:^(id<AspectInfo> aspectInfo) {
NSLog(#"UIButton called");
}
error:NULL];
Have a look on the AspectInfo for more information on the instance called.
Buttons can have multiple actions attached to them. You could always add a logging action to each of your buttons. The action method receives the sender, so you could log information about the button that was tapped.
You can subclass UIButton to add logging. The accepted answer on
objective C: Buttons created from subclass of UIButton class not working
has a good explanation on why this is one of the few instances that subclassing may be useful.
Basically UIButton inherits from UIControl and UIControl Class Reference states
Subclassing Notes You may want to extend a UIControl subclass for either of two reasons:
To observe or modify the dispatch of action messages to targets for particular events
To provide custom tracking behavior (for example, to change the highlight appearance)

My view controller in storyboard will not connect to the viewcontroller.h file or the .m

I'm sort of new to xCode so i really don't know much about it. I'm having a problem with my .h and .m files. when I control click on of the view or the pan gesture recognizers, it wont connect. It's been two days and I still don't know. I do have multiple view controllers, but I wanted to make a slide-out menu drawer like the one on the Facebook app.
Did you forget the class name?
check if the target actionof the .m file of objective-c class is checked in the attribute or identity inspector. if it is not checked the make it checked. hope it works...
If you are just looking for a library that does the slide in behavior as Facebook and others take a look at: https://github.com/SocialObjects-Software/AMSlideMenu
or follow Ray Wenderlich's tutorial: http://www.raywenderlich.com/32054/how-to-create-a-slide-out-navigation-like-facebook-and-path

How to create a flat UIActionSheet

Today's trend in apps includes flat designs, and now I am doing an app that follows with this trend. My problem now is how to create a UIAcionSheet that match with my App Screen's flat UI Design. In relation with this, I saw Instagram's action sheet and I found it interesting. I wish to have that design in my app. Anyone knows how to implement this in ios apps? I have provided a screen shot from instagram app.
You can use RDActionSheet from git
https://github.com/reddavis/RDActionSheet
I hope it will help you..!!
yes,
you can use https://github.com/reddavis/RDActionSheet and also u can change image and color of text and background image of action sheet
You can use FlatUIKIT from Git
https://github.com/Grouper/FlatUIKit
Go through the documentation & you will know how to use it. Awesome collection of Flat UI classes.
You can create a subclass CustomActionSheet derived UIActionSheet,
and create a method called CustomUI in it. Design your code here.
use CustomActionSheet like UIActionSheet, except must call method CustomUI of subclass in willPresentActionSheet delegate:
- (void)willPresentActionSheet:(UIActionSheet *)actionSheet {
if ([actionSheet isKindOfClass:[CustomActionSheet class]]) {
CustomActionSheet *sheet = (CustomActionSheet*)actionSheet;
[sheet CustomUI];
}
}

Example of how to customize UIActivityViewController share menu?

Is there an example of how to customize UIActivityViewController share menu with my own icon and IBAction?
I have seen this...
- (id)initWithActivityItems:(NSArray *)activityItems applicationActivities:(NSArray *)applicationActivities;
but I have not gotten it to work yet.
You first need to subclass UIActivity.
Then you need to override certain methods, including activityImage for setting the icon and performActivity for performing the action (what you call "IBAction" in your question).
If instead of performing the action silently, you first need further user interaction and info for your custom activity (e.g., like the Twitter post for the standard UIActivity), you should override activityViewController rather than performActivity.
After you have subclassed UIActivity (as, e.g, MyActivity), you should create an instance of MyActivity and make it an element of the applicationActivities array that you pass to initWithActivityItems:applicationActivities:.
Have a look at the documentation for UIActivity for exactly what you need to override when subclassing and for icon requirements.
Hope this helps a little.

Resources