Warning: Attempt to present <MachinesDetailViewController: 0x1e5bfc50> on <UITabBarController: 0x1f867d90> whose view is not in the window hierarchy - window

Im trying to get a scanned QR code to display a view controller with information about the item the code represents. When I try and segue to the detail view controller, it comes up with:
Warning: Attempt to present <MachinesDetailViewController: 0x1e5bfc50> on <UITabBarController: 0x1f867d90> whose view is not in the window hierarchy!
The MainViewController is withing a main tab bar controller, but the detail view controller is within a navigation controller which is withing the tab bar controller.
Heres my MainViewController.m where this is sitting.
//
// FirstViewController.m
// Fitness Plus+
//
// Created by Tom Brereton on 26/01/13.
// Copyright (c) 2013 Tom Brereton. All rights reserved.
//
#import "MainViewController.h"
#import "MachinesDetailViewController.h"
#interface MainViewController ()
#end
#implementation MainViewController
#synthesize resultText, machineKeys, codeInt, machineArea, machineName;
- (IBAction)scanButton:(id)sender {
NSLog(#"ehe");
// ADD: present a barcode reader that scans from the camera feed
ZBarReaderViewController *reader = [[ZBarReaderViewController alloc] init];
reader.readerDelegate = self;
reader.supportedOrientationsMask = ZBarOrientationMaskAll;
ZBarImageScanner *scanner = reader.scanner;
// TODO: (optional) additional reader configuration here
// EXAMPLE: disable rarely used I2/5 to improve performance
[scanner setSymbology: ZBAR_I25
config: ZBAR_CFG_ENABLE
to: 0];
NSLog(#"Got here");
// present and release the controller
[self presentViewController: reader
animated: YES
completion:nil];
}
- (void) imagePickerController: (UIImagePickerController*) reader
didFinishPickingMediaWithInfo: (NSDictionary*) info
{
// ADD: get the decode results
id<NSFastEnumeration> results =
[info objectForKey: ZBarReaderControllerResults];
ZBarSymbol *symbol = nil;
for(symbol in results)
// EXAMPLE: just grab the first barcode
break;
NSLog(#"Naht Here");
// EXAMPLE: do something useful with the barcode data
// Scan the machines.plist array and print it to the console.
NSString *filePath = [[NSBundle mainBundle] pathForResource:#"machines" ofType:#"plist"];
NSDictionary *machineDict = [NSDictionary dictionaryWithContentsOfFile:filePath];
machineKeys = [machineDict objectForKey:#"Exercises"];
machineArea = [machineDict objectForKey:#"Area"];
resultText.text = symbol.data;
//Convert code into integer value and put it inside codeInt
codeInt = [symbol.data intValue];
NSLog(#"Scanned Value: %#", [machineKeys objectAtIndex:codeInt]);
// EXAMPLE: do something useful with the barcode image
[self performSegueWithIdentifier:#"showDetailFromMain" sender:reader];
// ADD: dismiss the controller (NB dismiss from the *reader*!)
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)reader {
if ([[segue identifier] isEqualToString:#"showDetailFromMain"]) {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:#"MainStoryboard" bundle:nil];
MachinesDetailViewController *machineViewController = [storyboard instantiateViewControllerWithIdentifier:#"showMachineDetailViewController"];
machineViewController = [segue destinationViewController];
machineName = [machineKeys objectAtIndex:codeInt];
[machineViewController setMachineNameLabel: machineName];
}
}
- (void) viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#end
The ZBar stuff is just relating to the QR scanning API.
And here is the MachineDetailsViewController.m.
//
// MachinesDetailViewController.m
// Fitness Plus+
//
// Created by Tom Brereton on 27/01/13.
// Copyright (c) 2013 Tom Brereton. All rights reserved.
//
#import "MachinesDetailViewController.h"
#interface MachinesDetailViewController ()
#property(nonatomic, copy) NSString *title;
#end
#implementation MachinesDetailViewController
#synthesize machineLabel, machineName, instructionsLabel, typeLabel, mainMuscleLabel, otherMuscleLabel, equipmentLabel, machineDictionary, machineArray, mainMuscleLabelString, instructionLabelString, typeLabelString, otherMuscleLabelString, equipmentLabelString, title, machineNameLabel;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
// Set the Label text with the selected machine name
machineName = machineNameLabel;
mainMuscleLabel.text = mainMuscleLabelString;
otherMuscleLabel.text = otherMuscleLabelString;
equipmentLabel.text = equipmentLabelString;
typeLabel.text = typeLabelString;
instructionsLabel.text = instructionLabelString;
self.navigationItem.title = machineName;
NSLog(#"got it");
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#end
Thanks, if you need more info just ask.
Tom

Struggled with the exact same issue,
my solution was to call the segue this way:
[reader dismissViewControllerAnimated:YES completion:^{
NSLog(#"Perform segue");
[self performSegueWithIdentifier:#"showDetailFromMain" sender:self];
}];
I also had to connect the segue to the view and not to a single button.
Hope this works for you.

Related

Clipboard working?

I have a simple project where I have several NSStrings combined into one. Then, that string is copied to the clipboard. Here is the code:
#import "CopyToClipViewController.h"
#interface CopyToClipViewController ()
#end
#implementation CopyToClipViewController
#synthesize device;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
if (self.device) {
NSString *namevalue;
NSString *versionvalue;
NSString *companyvalue;
namevalue = [self.device valueForKey:#"name"];
versionvalue = [self.device valueForKey:#"version"];
companyvalue = [self.device valueForKey:#"company"];
NSString *shareString = [NSString stringWithFormat:#"I have performed %# minutes of %# %#",namevalue, versionvalue, companyvalue];
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = shareString;
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#end
However, after I build and run the project in the simulator, I can't seem to paste the string into any other app. What is the issue? Thanks in advance!
I think you can paste it only in simulator-open some app with textfield and longpress the textfield. Tap paste

Perform segue with accessoryButton

I am doing master + detail pages. I have successfully made tapping the cell rows in the master page jump to detail page, using the code below
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:#"MasterToDetail" sender:indexPath];
}
However becuase my master page cell rows also have accessory buttons, i need to make these buttons able to jump to the detail page too through tapping. So i implemented code
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:#"MasterToDetail" sender:self];
}
Howver the details dispalyed is not correct. It always shows the first detail data in the datalist. I changed sender:self to sender:indexPath also no working.
I used stackoverflow answers from here and here. I am a beginner, so some concepts still no clear sorry.
Edited
- preparesegue for masterviewcontroller.m
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
DetailViewController *detailController =segue.destinationViewController;
SearchDataDetail *bug = [self.bugs objectAtIndex:self.tableView.indexPathForSelectedRow.row];
detailController.detailItem = bug;
}
-detailviewcontroller.m
#import "DetailViewController.h"
#import "SearchData.h"
#import "SearchDataDetail.h"
#interface DetailViewController ()
- (void)configureView;
#end
#implementation DetailViewController
- (void)configureView
{
// Update the user interface for the detail item.
self.rateView.notSelectedImage = [UIImage imageNamed:#"shockedface2_empty.png"];
self.rateView.halfSelectedImage = [UIImage imageNamed:#"shockedface2_half.png"];
self.rateView.fullSelectedImage = [UIImage imageNamed:#"shockedface2_full.png"];
self.rateView.editable = YES;
self.rateView.maxRating = 5;
self.rateView.delegate = self;
if (self.detailItem) {
self.titleField.text = self.detailItem.data.title;
self.rateView.rating = self.detailItem.data.rating;
self.imageView.image = self.detailItem.fullImage;
}
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
[self configureView];
}
- (void)viewDidUnload
{
[self setTitleField:nil];
[self setRateView:nil];
[self setImageView:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return YES;
}
- (void)rateView:(RateView *)rateView ratingDidChange:(float)rating {
self.detailItem.data.rating = rating;
}
#end
This is due to following statement
SearchDataDetail *bug = [self.bugs objectAtIndex:self.tableView.indexPathForSelectedRow.row];
In this self.tableView.indexPathForSelectedRow.row will work only for only for row selection
not for accessoryButton tap.
You can solve it by two easy way
Declare a variable in .h file to store indexPath and use it to pass selected indexPath.
Pass indexPath in sender
All the best..

Page View Controller - from images to another view controller

I'm a bit perplexed about what I'm trying to accomplish. I have a page view controller that has a data source containing an array list of images. It's actually a tutorial that a user can flip through. What I'm trying to do is make the last page a log in screen so the user can enter info and hit a login button. I thought this would be as simple as adding a login view controller to the array but oooh how wrong I was D: When I tried that I got this error:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController _isResizable]: unrecognized selector sent to instance 0xa160660'
I do apologise for being such a noob I'm new to all of this just trying to get my head around it. Here's my code (accomplished by using this site actually):
My data source (ModelController.h)
#import <Foundation/Foundation.h>
#class DataViewController;
#interface ModelController : NSObject <UIPageViewControllerDataSource>
- (DataViewController *)viewControllerAtIndex:(NSUInteger)index storyboard:(UIStoryboard *)storyboard;
- (NSUInteger)indexOfViewController:(DataViewController *)viewController;`
#end
ModelController.m
#import "ModelController.h"
#import "DataViewController.h"
#import "LoginViewController.h"
#interface ModelController()
#property (readonly, strong, nonatomic) NSArray *pageData;
#end
#implementation ModelController
- (id)init
{
self = [super init];
if (self)
{
// Create the data model
_pageData = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:#"tutorial1.png"],
[UIImage imageNamed:#"tutorial2.png"],
[UIImage imageNamed:#"lastWishes.png"],
[UIImage imageNamed:#"todo.png"],
[UIImage imageNamed:#"web.png"],
(LoginViewController*)[[UIViewController alloc] init],
nil];
}
return self;
}
- (DataViewController *)viewControllerAtIndex:(NSUInteger)index storyboard:(UIStoryboard *)storyboard
{
// Return the data view controller for the given index.
if (([self.pageData count] == 0) || (index >= [self.pageData count]))
{
return nil;
}
// Create a new view controller and pass suitable data.
DataViewController *dataViewController = [storyboard instantiateViewControllerWithIdentifier:#"DataViewController"];
dataViewController.dataObject = self.pageData[index];
return dataViewController;
}
- (NSUInteger)indexOfViewController:(DataViewController *)viewController
{
// Return the index of the given data view controller.
// For simplicity, this implementation uses a static array of model objects and the view controller stores the model object; you can therefore use the model object to identify the index.
return [self.pageData indexOfObject:viewController.dataObject];
}
#pragma mark - Page View Controller Data Source
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController
{
NSUInteger index = [self indexOfViewController:(DataViewController *)viewController];
if ((index == 0) || (index == NSNotFound)) {
return nil;
}
index--;
return [self viewControllerAtIndex:index storyboard:viewController.storyboard];
}
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController
{
NSUInteger index = [self indexOfViewController:(DataViewController *)viewController];
if (index == NSNotFound) {
return nil;
}
index++;
if (index == [self.pageData count]) {
return nil;
}
return [self viewControllerAtIndex:index storyboard:viewController.storyboard];
}
#end
The Parent (RootViewController.h)
#import <UIKit/UIKit.h>
#interface RootViewController : UIViewController <UIPageViewControllerDelegate>
#property (strong, nonatomic) UIPageViewController *pageViewController;
#end
RootViewController.m
#import "RootViewController.h"
#import "ModelController.h"
#import "DataViewController.h"
#interface RootViewController ()
#property (readonly, strong, nonatomic) ModelController *modelController;
#end
#implementation RootViewController
#synthesize modelController = _modelController;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// Configure the page view controller and add it as a child view controller.
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation:UIPageViewControllerNavigationOrientationVertical options:nil];
self.pageViewController.delegate = self;
DataViewController *startingViewController = [self.modelController viewControllerAtIndex:0 storyboard:self.storyboard];
NSArray *viewControllers = #[startingViewController];
[self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:NULL];
self.pageViewController.dataSource = self.modelController;
[self addChildViewController:self.pageViewController];
[self.view addSubview:self.pageViewController.view];
// Set the page view controller's bounds using an inset rect so that self's view is visible around the edges of the pages.
CGRect pageViewRect = self.view.bounds;
self.pageViewController.view.frame = pageViewRect;
[self.pageViewController didMoveToParentViewController:self];
// Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily.
self.view.gestureRecognizers = self.pageViewController.gestureRecognizers;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (ModelController *)modelController
{
// Return the model controller object, creating it if necessary.
// In more complex implementations, the model controller may be passed to the view controller.
if (!_modelController) {
_modelController = [[ModelController alloc] init];
}
return _modelController;
}
#pragma mark - UIPageViewController delegate methods
/*
- (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating: (BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted: (BOOL)completed
{
}
*/
- (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation
{
// Set the spine position to "min" and the page view controller's view controllers array to contain just one view controller. Setting the spine position to 'UIPageViewControllerSpineLocationMid' in landscape orientation sets the doubleSided property to YES, so set it to NO here.
UIViewController *currentViewController = self.pageViewController.viewControllers[0];
NSArray *viewControllers = #[currentViewController];
[self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:NULL];
self.pageViewController.doubleSided = NO;
return UIPageViewControllerSpineLocationMin;
}
#end
The Child (DataViewController.h)
#import <UIKit/UIKit.h>
#interface DataViewController : UIViewController
#property (strong, nonatomic) id dataObject;
#property (weak, nonatomic) IBOutlet UIImageView *imageView;
#end
DataViewController.m
#import "DataViewController.h"
#interface DataViewController ()
#end
#implementation DataViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.imageView.image = _dataObject;
}
#end
Once again, the code in question is here where I'm trying to add a view controller to the data source as the last page:
_pageData = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:#"tutorial1.png"],
[UIImage imageNamed:#"tutorial2.png"],
[UIImage imageNamed:#"lastWishes.png"],
[UIImage imageNamed:#"todo.png"],
[UIImage imageNamed:#"web.png"],
(LoginViewController*)[[UIViewController alloc] init],
nil];
and getting unrecognized selector error when at runtime. I've also tried this as well:
- (id)init
{
self = [super init];
if (self)
{
LoginViewController *viewController = [self.storyboard instantiateViewControllerWithIdentifier:#"LoginViewController"];
// Create the data model
_pageData = [[NSArray alloc] initWithObjects:
[UIImage imageNamed:#"tutorial1.png"],
[UIImage imageNamed:#"tutorial2.png"],
[UIImage imageNamed:#"lastWishes.png"],
[UIImage imageNamed:#"todo.png"],
[UIImage imageNamed:#"web.png"],
viewController,
nil];
}
return self;
}
Any suggestions would be great. THanks!!
Your idea is 100% correct, your implementation is not.
This line:
dataViewController.dataObject = self.pageData[index];
is very suspicious because that will return a UIViewController in the case of your login screen. I would suggest you type-check your page data, if it is already a UIViewController subclass, just return it, if it is (in your case) a UIImage add it as the data object.

Building Ipad app and once i added a modal view my bool errors out

I am erroring out with Bool and before I added a modal view and now it says bool is undefined. I dont understand why that is unless its because I'm using another nib for my modal view.
Do I need to call or change my boon now. Please advise.
//
// UrbanAgentViewController.m
// UrbanAgent
//
// Created by Dwayne Stephens on 4/2/12.
// Copyright 2012 __MyCompanyName__. All rights reserved.
//
#import "UrbanAgentViewController.h"
#import "NewContactController.h"
#implementation UrbanAgentViewController
// our own buttonTapped method
-(IBAction) buttonTapped: (id) sender {
NewContactController *ivc = [[NewContactController alloc] init];
ivc.delegate = self;
UINavigationController *nc = [[UINavigationController alloc]
initWithRootViewController:ivc];
[self presentModalViewController:nc animated:YES];
[ivc release];
[nc release];
}
-(void) doneButtonPressed: (NSArray *) values
{
[self dismissModalViewControllerAnimated:YES];
NSString *message =
[[NSString alloc]
initWithFormat:#"The values were %#, %#, %#, %#, %#, and %#",
[values objectAtIndex:0], [values objectAtIndex:1], [values objectAtIndex:2],
[values objectAtIndex:3], [values objectAtIndex:4], [values objectAtIndex:5]];
UIAlertView *alert =
[[UIAlertView alloc] initWithTitle:#"Values Passed"
message:message delegate:nil
cancelButtonTitle:#"Excellent!" otherButtonTitles:nil ];
[alert show];
[alert release];
[message release];
/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
*/
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
#end
You need a closing curly brace on doneButtonPressed:.

How to increase scroll speed of UIWebView?

I have an app that uses a UIWebView on one of it's tabs.
Everything is working like it should, but the speed that the view is scrolling is extremely slow! It doesn't matter if I build it in the simulator or if I build it in my iPhone, it's the same slow scroll.
How can I increase the scrolling speed of the view? I've noticed that it will stop scrolling as soon as the finger leaves the screen, instead of keep scrolling and decelerate like in safari, does this have anything to do with it?
The is my .h file:
// FirstViewController_SE.h
// WebApp
//
// Created by Camilla Fröberg on 2012-03-29.
// Copyright (c) 2012 SafeLine Sweden AB. All rights reserved.
//
#import <UIKit/UIKit.h>
#interface FirstViewController_SE : UIViewController<UIWebViewDelegate> {
IBOutlet UIWebView *webDisplay_SE;
UIBarButtonItem* mBack;
UINavigationItem* back;
}
#property(nonatomic,retain) UIWebView *webDisplay_SE;
#property (nonatomic, retain) IBOutlet UIBarButtonItem* back;
- (void)updateButtons;
#end
And this is my .m file:
//
// FirstViewController_SE.m
// WebApp
//
// Created by Camilla Fröberg on 2012-03-29.
// Copyright (c) 2012 SafeLine Sweden AB. All rights reserved.
//
#import "FirstViewController_SE.h"
#interface FirstViewController_SE ()
#end
#implementation FirstViewController_SE;
#synthesize webDisplay_SE;
#synthesize back = mBack;
#pragma mark - View lifecycle
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
self.webDisplay_SE.delegate = self;
NSString *urlAddress = #"http://www.safeline.eu/mobile/se/product";
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[webDisplay_SE loadRequest:requestObj];
[self updateButtons];
}
- (void)viewDidUnload {
self.back = nil;
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
- (void)updateButtons
{
self.back.enabled = self.webDisplay_SE.canGoBack;
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (BOOL)webDisplay_SE:(UIWebView *)webDisplay_SE shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
return YES;
}
- (void)webViewDidStartLoad:(UIWebView *)webDisplay_SE
{
[self updateButtons];
}
- (void)webViewDidFinishLoad:(UIWebView *)webDisplay_SE
{
[self updateButtons];
}
#end
Try this:
webView.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal;
Note: there's a bug in iOS 9 that you may need to workaround https://stackoverflow.com/a/32843700/308315

Resources