UILongPressGestureRecognizer in subview didnot work

Issue – (void)viewDidLoad { [super viewDidLoad]; CGRect imageRect = (CGRect){105, 180, 110, 110}; UIImage *image = [UIImage imageNamed: @”sasuke.png”]; UIImageView *imageView = [[UIImageView alloc] initWithFrame:imageRect]; [imageView setImage: image]; UILongPressGestureRecognizer *longGnizer=[[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longGo:)]; imageView.userInteractionEnabled = YES; [imageView addGestureRecognizer:longGnizer]; [self.view addSubview:imageView]; }

Continue reading

Deactivate UILongPressGestureRecognizer after certain seconds?

Issue How can i deactivate my UILongPressGestureRecognizer automatically after certain seconds? Solution for set time interval in -viewDidLoad : NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:5.0f target:self selector:@selector(removeGesture) userInfo:nil repeats:NO]; in selector method: -(void)removeGesture { [self.view removeGestureRecognizer:longGesture1]; } after 5 seconds UILongPressGestureRecognizer

Continue reading

Long Press Gesture called multiple times

Issue I am getting an issue with UILongPressGestureRecognizer, I have used this code:- func addLongPressGesture(){ let lngPr = UILongPressGestureRecognizer.init(target: self, action: #selector(self.handleLongPress(gesture:))) lngPr.delaysTouchesEnded = true self.addGestureRecognizer(lngPr) } @objc func handleLongPress(gesture:UIGestureRecognizer){ if selectedIndexPath != nil && delegate != nil{ self.delegate?.delegateLongPressed(atIndexPath: selectedIndexPath!)

Continue reading

On long press, how do you call an ImagePreviewController: UIViewController from an objective c function instead of a contextMenuInteraction function?

Issue This function below needs to instead go into an ObjC function ///this 1st func is in UITableViewController, the others are in UITableViewCell override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if let cell = tableView.dequeueReusableCell(withIdentifier: "cell",

Continue reading

RestKit -Problems with object mapping of "advanced data object"?

Issue Im having a problem with the mapping of the: latest_update field in the JSON data. Recieving this JSON data from my webservice: {“Places”:[ {“place_ID”: “7cceedda-ed3a-11e0-a1a8-858e3974979a”, “timestamp”: “2011-10-02 23:24:42” }, {“place_ID”: “7cceedda-ed3a-11e0-a1a8-858e3974933x”, “timestamp”: “2011-10-02 23:24:42” }, {“latest_update”:”2011-10-13 12:16:17″}] } And

Continue reading

How to use RKObjectMapping as a standalone library

Issue I use AFNetworking to write a RESTful client. An then use JSONKit to parse the response data to a NSDictionary. Example: – (void)postPath:(NSString *)path parameters:(NSDictionary *)parameters success:(void (^)(AFHTTPRequestOperation *operation, id responseObject, NSDictionary* jsonDictionary))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure {

Continue reading

Objective-C class object not mapping to array

Issue How can I pass the event to the toDoArray? I’m not sure what I’m missing. Any help appreciated. SDEventModel.h @interface SDEventModel : AWSDynamoDBObjectModel <AWSDynamoDBModeling> ViewController.h @property (nonatomic, strong) NSArray *toDoArray; ViewController.m if (task.result) { AWSDynamoDBPaginatedOutput *paginatedOutput = task.result; for

Continue reading

NSURLCache, together with NSURLSession, does not respect: Cache-Control: max-age:86000, private, must-revalidate

Issue In AppDelegate.m, I configured: NSURLCache *sharedURLCache = [[NSURLCache alloc] initWithMemoryCapacity:20 * 1024 * 1024 diskCapacity:100 * 1024 * 1024 diskPath:@”FhtHttpCacheDir”]; Then the http request: – (void) testRestfulAPI{ NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration]; NSURLSession *session = [NSURLSession sessionWithConfiguration:config]; NSMutableURLRequest *request

Continue reading

Nativescript: Navigate between router-outlets

Issue For better introduction see the blog post about outlets. I use a TabView to navigate through my mobile app written with nativescript (ProtectedComponent). <TabView #tabView tabsBackgroundColor=”#f57c00″ selectedTabTextColor=”#B23010″ [(ngModel)]=”selectedIndex” (selectedIndexChanged)=”tabViewIndexChange(tabView.selectedIndex)”> <StackLayout *tabItem=”{iconSource: ‘res://tab-icons/cats’}”> <cats-tab></cats-tab> </StackLayout> <StackLayout *tabItem=”{iconSource: ‘res://tab-icons/dogs’}”> <dogs-tab></dogs-tab> </StackLayout>

Continue reading

How to underline a UILabel in swift?

Issue How to underline a UILabel in Swift? I searched the Objective-C ones but couldn’t quite get them to work in Swift. Solution You can do this using NSAttributedString Example: let underlineAttribute = [NSAttributedString.Key.underlineStyle: NSUnderlineStyle.thick.rawValue] let underlineAttributedString = NSAttributedString(string: "StringWithUnderLine",

Continue reading

iOS singleton class

Issue I am having a singleton class MyController of type UIViewController. I could able to access the view property like [MyController sharedInstance].view and could able to set that to nil like, [MyController sharedInstance].view = nil; I wanna restrict someone accessing

Continue reading