I'm making an iPhone/iPad app where I have PickerView. For PickerView, I am using CPPickerView.
I'm trying to disable this pickerview and to do that, I wrote this code:
[realEstatePV setUserInteractionEnabled:NO];
However, above is not working. I can still move the CPPickerView.
Any idea how to get this done?
I had the same problem. So i updated the CPPickerView, and its very easy.
Open CPPickerView.h and add a method declaration
- (void)enabled:(BOOL)val;
Now open CPPickerView.mand add implementation method.
-(void)enabled:(BOOL)val {
self.contentView.scrollEnabled = val;
}
Its done......
Now You can disable CPPickerView like this.
[realEstatePV enabled:NO];
To enable again use
[realEstatePV enabled:YES];
Hope this helps.
Related
I have a static group of cells, a few groups actually, and for some reason the pull to refresh function is enabled, I can't figure out where, at least in Xcode Interface builder an option is to disable that. I assume I'll have to do it programmatically.
Does anyone know how this needs to be done in Swift?
If you're using UITableViewController, it should be something as simple as
self.refreshControl = nil
In storyboard, go to your Attributes Inspector for your View Controller and disable it there where it says 'Refreshing':
For swift 4 you can using
self.yourTableView.refreshControl = nil
I'm working on iOS 8 custom keyboard extension right now, and there are some issues that I cannot figure out.
First, I think the UITextInputDelegate Methods are not working as I expected.
Does this sound right: selectionWillChange: and selectionDidChange: methods should be called when user long-presses typing area? And textWillChange: and textDidChange: methods should be called whenever the text is literally changing?
Actually, what I observed is that, when I changed selection in text input area, textWillChange: and textDidChange: are called, and I cannot get a clue that the other two methods are called in what condition. If anyone knows about the usage of these delegate methods, please let me know.
Second, I know the playInputClick: method can be used to virtualize keyboard click sound in custom keyboard. As this is applicable in a normal situation, I found it impossible to apply in iOS 8 custom keyboard extension. My app consists of one keyboard view controller, and custom view that subclasses UIView is added to this view controller. My approach is that UIInputViewAudioFeedback delegate is declared in this custom view, enableInputClicksWhenVisible method is returning YES, class method that calls [[UIDevice currentDevice] playInputClick] is set, then this method is called wherever the keyboard sound is needed: which is not working at all.
Is my approach is wrong in any way? If anyone has succeeded in using playInputClick method, please share your wisdom.
Thank you
It is best to play the Audio on a queue rather than in the UI key handler
func playPressKeySound() {
let PRESS_KEY_DEFAULT_SOUND_ID: SystemSoundID = 1104
dispatch_async(dispatch_get_main_queue()) {
AudioServicesPlaySystemSound(PRESS_KEY_DEFAULT_SOUND_ID)
}
}
NOTE: this only works if the keyboard has Full Access switched on, so best test there is full access before calling, otherwise the keyboard can suffer long pauses.
For the second question, try AudioServicesPlaySystemSound
#define PRESS_KEY_DEFAULT_SOUND_ID 1104
- (void)playPressKeySound {
if (self.openPressSound) {
AudioServicesPlaySystemSound(PRESS_KEY_DEFAULT_SOUND_ID);
}
}
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];
}
}
I'm trying to use the StackScrollView class but I feel something important is missing here: we can add views to the stack, but we can't remove them.
Does anyone made a function to do it?
I already tried to add a nil controller but it didn't work?
You remove them using by swiping. If you look at StackScrollViewController.m you'll see there is a bounceBack:finished:context: method which is responsible for animating the view when you go back.
If you want to bounce back programmatically (maybe you have a button for this or anything like that) you should go take a look at how the bounceBack:finished:context: method is used in StackScrollViewController.m
Just add this custom method to StackScrollViewController and then call it from where you want.
- (void)dismissStackViewController {
[[[slideViews subviews] lastObject] removeFromSuperview];
}
is it possible to click UIButton and to call its action through Programming without clicking?
You can just simply call the method associated with your UIButton action as follow :
- (IBAction)myMethod:(id)sender {
// some code here
}
When you want to fire an action :
[self myMethod:nil];
Yes you can do it programmatically just send a event to button
Well I guess you can get a little help from a friend of mine that help me a lot to get start with objective C and Iphone development Basics. maybe you already have seen him but if not here is the link http://www.youtube.com/watch?v=B7jB0D3Y7Ws&feature=channel pretty easy to understand.