UIScrollView with contentsize set can't scroll beyond frame boundary - iphone

I Feel like I'm missing something super obvious here.
I have a UIScrollView in a storyboard, with a outlet to the view controller.
I programatically add a series of views, and set the content size of the scroll view.
Even though I've set the scrollview's contentsize height to a very high value, I can't scroll beyond the views bounds.
I'm printing the content size and frame size after setting it. As well as the contentoffset.y when the scrollview scrolls.
Here is an example of the console output:
2013-09-24 21:54:34.531 [Redacted] scrollView frame size: 320.000000,460.000000
2013-09-24 21:54:34.531 [Redacted] scrollView content size: 0.000000,10000.000000
2013-09-24 21:54:36.259 [Redacted] scroll to: 6.000000
2013-09-24 21:54:36.275 [Redacted] scroll to: 17.000000
2013-09-24 21:54:36.291 [Redacted] scroll to: 29.000000
2013-09-24 21:54:36.308 [Redacted] scroll to: 41.000000
2013-09-24 21:54:36.325 [Redacted] scroll to: 52.000000
2013-09-24 21:54:36.341 [Redacted] scroll to: 65.000000
2013-09-24 21:54:36.358 [Redacted] scroll to: 74.000000
2013-09-24 21:54:36.375 [Redacted] scroll to: 84.000000
2013-09-24 21:54:36.392 [Redacted] scroll to: 90.000000
2013-09-24 21:54:36.408 [Redacted] scroll to: 95.000000
2013-09-24 21:54:36.425 [Redacted] scroll to: 100.000000
2013-09-24 21:54:36.441 [Redacted] scroll to: 103.000000
2013-09-24 21:54:36.459 [Redacted] scroll to: 107.000000
2013-09-24 21:54:36.475 [Redacted] scroll to: 110.000000
2013-09-24 21:54:36.492 [Redacted] scroll to: 114.000000
2013-09-24 21:54:36.509 [Redacted] scroll to: 118.000000
2013-09-24 21:54:36.525 [Redacted] scroll to: 122.000000
2013-09-24 21:54:36.542 [Redacted] scroll to: 126.000000
2013-09-24 21:54:36.558 [Redacted] scroll to: 130.000000
2013-09-24 21:54:36.575 [Redacted] scroll to: 134.000000
2013-09-24 21:54:36.592 [Redacted] scroll to: 141.000000
2013-09-24 21:54:36.609 [Redacted] scroll to: 147.000000
2013-09-24 21:54:36.625 [Redacted] scroll to: 152.000000
2013-09-24 21:54:36.642 [Redacted] scroll to: 156.000000
2013-09-24 21:54:36.659 [Redacted] scroll to: 159.000000
2013-09-24 21:54:36.676 [Redacted] scroll to: 160.000000
2013-09-24 21:54:36.776 [Redacted] scroll to: 161.000000
2013-09-24 21:54:37.010 [Redacted] scroll to: 162.000000
2013-09-24 21:54:37.026 [Redacted] scroll to: 168.000000
2013-09-24 21:54:37.043 [Redacted] scroll to: 179.000000
2013-09-24 21:54:37.060 [Redacted] scroll to: 195.000000
2013-09-24 21:54:37.077 [Redacted] scroll to: 207.000000
2013-09-24 21:54:37.097 [Redacted] scroll to: 209.000000
2013-09-24 21:54:37.112 [Redacted] scroll to: 219.000000
2013-09-24 21:54:37.129 [Redacted] scroll to: 223.000000
2013-09-24 21:54:37.145 [Redacted] scroll to: 222.000000
2013-09-24 21:54:37.162 [Redacted] scroll to: 218.000000
2013-09-24 21:54:37.179 [Redacted] scroll to: 212.000000
2013-09-24 21:54:37.195 [Redacted] scroll to: 204.000000
2013-09-24 21:54:37.212 [Redacted] scroll to: 195.000000
2013-09-24 21:54:37.229 [Redacted] scroll to: 186.000000
2013-09-24 21:54:37.245 [Redacted] scroll to: 177.000000
2013-09-24 21:54:37.262 [Redacted] scroll to: 168.000000
2013-09-24 21:54:37.279 [Redacted] scroll to: 160.000000
2013-09-24 21:54:37.296 [Redacted] scroll to: 152.000000
2013-09-24 21:54:37.312 [Redacted] scroll to: 145.000000
2013-09-24 21:54:37.329 [Redacted] scroll to: 138.000000
2013-09-24 21:54:37.346 [Redacted] scroll to: 133.000000
2013-09-24 21:54:37.362 [Redacted] scroll to: 127.000000
2013-09-24 21:54:37.379 [Redacted] scroll to: 122.000000
2013-09-24 21:54:37.396 [Redacted] scroll to: 118.000000
2013-09-24 21:54:37.412 [Redacted] scroll to: 114.000000
2013-09-24 21:54:37.429 [Redacted] scroll to: 111.000000
2013-09-24 21:54:37.445 [Redacted] scroll to: 108.000000
2013-09-24 21:54:37.462 [Redacted] scroll to: 105.000000
2013-09-24 21:54:37.479 [Redacted] scroll to: 103.000000
2013-09-24 21:54:37.496 [Redacted] scroll to: 101.000000
2013-09-24 21:54:37.512 [Redacted] scroll to: 99.000000
2013-09-24 21:54:37.529 [Redacted] scroll to: 98.000000
2013-09-24 21:54:37.545 [Redacted] scroll to: 96.000000
2013-09-24 21:54:37.562 [Redacted] scroll to: 95.000000
2013-09-24 21:54:37.579 [Redacted] scroll to: 94.000000
2013-09-24 21:54:37.595 [Redacted] scroll to: 93.000000
2013-09-24 21:54:37.629 [Redacted] scroll to: 92.000000
2013-09-24 21:54:37.645 [Redacted] scroll to: 91.000000
2013-09-24 21:54:37.695 [Redacted] scroll to: 90.000000
2013-09-24 21:54:37.745 [Redacted] scroll to: 89.000000
2013-09-24 21:54:37.862 [Redacted] scroll to: 88.000000
2013-09-24 21:54:38.381 [Redacted] scroll to: 89.000000
2013-09-24 21:54:38.397 [Redacted] scroll to: 108.000000
2013-09-24 21:54:38.414 [Redacted] scroll to: 127.000000
2013-09-24 21:54:38.431 [Redacted] scroll to: 150.000000
2013-09-24 21:54:38.448 [Redacted] scroll to: 164.000000
2013-09-24 21:54:38.464 [Redacted] scroll to: 182.000000
2013-09-24 21:54:38.481 [Redacted] scroll to: 195.000000
2013-09-24 21:54:38.499 [Redacted] scroll to: 213.000000
2013-09-24 21:54:38.516 [Redacted] scroll to: 222.000000
2013-09-24 21:54:38.533 [Redacted] scroll to: 224.000000
2013-09-24 21:54:38.550 [Redacted] scroll to: 222.000000
2013-09-24 21:54:38.566 [Redacted] scroll to: 217.000000
2013-09-24 21:54:38.583 [Redacted] scroll to: 209.000000
2013-09-24 21:54:38.599 [Redacted] scroll to: 201.000000
2013-09-24 21:54:38.616 [Redacted] scroll to: 192.000000
2013-09-24 21:54:38.633 [Redacted] scroll to: 183.000000
2013-09-24 21:54:38.650 [Redacted] scroll to: 174.000000
2013-09-24 21:54:38.666 [Redacted] scroll to: 166.000000
2013-09-24 21:54:38.683 [Redacted] scroll to: 157.000000
2013-09-24 21:54:38.699 [Redacted] scroll to: 150.000000
2013-09-24 21:54:38.716 [Redacted] scroll to: 143.000000
2013-09-24 21:54:38.733 [Redacted] scroll to: 137.000000
2013-09-24 21:54:38.749 [Redacted] scroll to: 131.000000
2013-09-24 21:54:38.766 [Redacted] scroll to: 126.000000
2013-09-24 21:54:38.783 [Redacted] scroll to: 121.000000
2013-09-24 21:54:38.799 [Redacted] scroll to: 117.000000
2013-09-24 21:54:38.816 [Redacted] scroll to: 113.000000
2013-09-24 21:54:38.833 [Redacted] scroll to: 110.000000
2013-09-24 21:54:38.849 [Redacted] scroll to: 107.000000
2013-09-24 21:54:38.866 [Redacted] scroll to: 105.000000
2013-09-24 21:54:38.883 [Redacted] scroll to: 102.000000
2013-09-24 21:54:38.900 [Redacted] scroll to: 100.000000
2013-09-24 21:54:38.916 [Redacted] scroll to: 99.000000
2013-09-24 21:54:38.933 [Redacted] scroll to: 97.000000
2013-09-24 21:54:38.950 [Redacted] scroll to: 96.000000
2013-09-24 21:54:38.966 [Redacted] scroll to: 95.000000
2013-09-24 21:54:38.983 [Redacted] scroll to: 94.000000
2013-09-24 21:54:39.000 [Redacted] scroll to: 93.000000
2013-09-24 21:54:39.016 [Redacted] scroll to: 92.000000
2013-09-24 21:54:39.049 [Redacted] scroll to: 91.000000
2013-09-24 21:54:39.083 [Redacted] scroll to: 90.000000
2013-09-24 21:54:39.150 [Redacted] scroll to: 89.000000
2013-09-24 21:54:39.267 [Redacted] scroll to: 88.000000
2013-09-24 21:54:43.145 [Redacted] scroll to: 91.000000
2013-09-24 21:54:43.162 [Redacted] scroll to: 97.000000
2013-09-24 21:54:43.178 [Redacted] scroll to: 103.000000
2013-09-24 21:54:43.195 [Redacted] scroll to: 109.000000
2013-09-24 21:54:43.212 [Redacted] scroll to: 115.000000
2013-09-24 21:54:43.229 [Redacted] scroll to: 120.000000
2013-09-24 21:54:43.245 [Redacted] scroll to: 124.000000
2013-09-24 21:54:43.262 [Redacted] scroll to: 127.000000
2013-09-24 21:54:43.279 [Redacted] scroll to: 130.000000
2013-09-24 21:54:43.296 [Redacted] scroll to: 131.000000
2013-09-24 21:54:43.312 [Redacted] scroll to: 133.000000
2013-09-24 21:54:43.329 [Redacted] scroll to: 135.000000
2013-09-24 21:54:43.345 [Redacted] scroll to: 136.000000
2013-09-24 21:54:43.374 [Redacted] scroll to: 137.000000
2013-09-24 21:54:43.664 [Redacted] scroll to: 138.000000
2013-09-24 21:54:43.681 [Redacted] scroll to: 139.000000
2013-09-24 21:54:43.697 [Redacted] scroll to: 143.000000
2013-09-24 21:54:43.714 [Redacted] scroll to: 149.000000
2013-09-24 21:54:43.731 [Redacted] scroll to: 155.000000
2013-09-24 21:54:43.748 [Redacted] scroll to: 161.000000
2013-09-24 21:54:43.764 [Redacted] scroll to: 166.000000
2013-09-24 21:54:43.781 [Redacted] scroll to: 169.000000
2013-09-24 21:54:43.798 [Redacted] scroll to: 172.000000
2013-09-24 21:54:43.814 [Redacted] scroll to: 174.000000
2013-09-24 21:54:43.831 [Redacted] scroll to: 177.000000
2013-09-24 21:54:43.848 [Redacted] scroll to: 178.000000
2013-09-24 21:54:43.865 [Redacted] scroll to: 180.000000
2013-09-24 21:54:43.887 [Redacted] scroll to: 181.000000
2013-09-24 21:54:43.914 [Redacted] scroll to: 183.000000
2013-09-24 21:54:43.948 [Redacted] scroll to: 184.000000
2013-09-24 21:54:43.981 [Redacted] scroll to: 186.000000
2013-09-24 21:54:43.998 [Redacted] scroll to: 187.000000
2013-09-24 21:54:44.015 [Redacted] scroll to: 188.000000
2013-09-24 21:54:44.031 [Redacted] scroll to: 189.000000
2013-09-24 21:54:44.048 [Redacted] scroll to: 190.000000
2013-09-24 21:54:44.065 [Redacted] scroll to: 191.000000
2013-09-24 21:54:44.082 [Redacted] scroll to: 192.000000
2013-09-24 21:54:44.116 [Redacted] scroll to: 194.000000
2013-09-24 21:54:44.149 [Redacted] scroll to: 195.000000
2013-09-24 21:54:44.182 [Redacted] scroll to: 196.000000
2013-09-24 21:54:44.216 [Redacted] scroll to: 197.000000
2013-09-24 21:54:44.266 [Redacted] scroll to: 198.000000
2013-09-24 21:54:44.283 [Redacted] scroll to: 199.000000
2013-09-24 21:54:44.299 [Redacted] scroll to: 200.000000
2013-09-24 21:54:44.316 [Redacted] scroll to: 202.000000
2013-09-24 21:54:44.349 [Redacted] scroll to: 203.000000
2013-09-24 21:54:44.366 [Redacted] scroll to: 204.000000
2013-09-24 21:54:44.449 [Redacted] scroll to: 205.000000
2013-09-24 21:54:44.500 [Redacted] scroll to: 206.000000
2013-09-24 21:54:44.601 [Redacted] scroll to: 207.000000
2013-09-24 21:54:44.932 [Redacted] scroll to: 189.000000
2013-09-24 21:54:44.949 [Redacted] scroll to: 174.000000
2013-09-24 21:54:44.966 [Redacted] scroll to: 161.000000
2013-09-24 21:54:44.982 [Redacted] scroll to: 151.000000
2013-09-24 21:54:44.999 [Redacted] scroll to: 141.000000
2013-09-24 21:54:45.016 [Redacted] scroll to: 133.000000
2013-09-24 21:54:45.032 [Redacted] scroll to: 126.000000
2013-09-24 21:54:45.049 [Redacted] scroll to: 121.000000
2013-09-24 21:54:45.066 [Redacted] scroll to: 116.000000
2013-09-24 21:54:45.082 [Redacted] scroll to: 112.000000
2013-09-24 21:54:45.099 [Redacted] scroll to: 108.000000
2013-09-24 21:54:45.116 [Redacted] scroll to: 105.000000
2013-09-24 21:54:45.133 [Redacted] scroll to: 102.000000
2013-09-24 21:54:45.149 [Redacted] scroll to: 100.000000
2013-09-24 21:54:45.166 [Redacted] scroll to: 98.000000
2013-09-24 21:54:45.183 [Redacted] scroll to: 97.000000
2013-09-24 21:54:45.200 [Redacted] scroll to: 96.000000
2013-09-24 21:54:45.216 [Redacted] scroll to: 94.000000
2013-09-24 21:54:45.233 [Redacted] scroll to: 93.000000
2013-09-24 21:54:45.266 [Redacted] scroll to: 92.000000
2013-09-24 21:54:45.283 [Redacted] scroll to: 91.000000
2013-09-24 21:54:45.316 [Redacted] scroll to: 90.000000
2013-09-24 21:54:45.366 [Redacted] scroll to: 89.000000
2013-09-24 21:54:45.483 [Redacted] scroll to: 88.000000
As you can see, I can't scroll beyond 200 odd.
I'm not new to iOS and have worked with scroll views before so I feel like I must be missing something really obvious.
Any help greatly appreciated, have a tight deadline!
EDIT: Added code:
checkboxes = [[NSMutableArray alloc] init];
{
// Just indented scope for tidyness, no functional meaning
[checkboxes addObject:[self createCheckboxWithLabel:#"Oil Level Checked"
atY:190]];
[checkboxes addObject:[self createCheckboxWithLabel:#"Coolant Level Checked"
atY:240]];
[checkboxes addObject:[self createCheckboxWithLabel:#"Tyre pressures & tread dept checked"
atY:290]];
[checkboxes addObject:[self createCheckboxWithLabel:#"Warning beacon & horn operating"
atY:340]];
[checkboxes addObject:[self createCheckboxWithLabel:#"Lights & indicators working & clean"
atY:390]];
[checkboxes addObject:[self createCheckboxWithLabel:#"Screen was & wipers operational"
atY:440]];
[checkboxes addObject:[self createCheckboxWithLabel:#"Mirrors undamaged & clean"
atY:490]];
[checkboxes addObject:[self createCheckboxWithLabel:#"Road Tax & MOD discs present & valid"
atY:540]];
[checkboxes addObject:[self createCheckboxWithLabel:#"PPE in vechile"
atY:590]];
[checkboxes addObject:[self createCheckboxWithLabel:#"Fire Extinguisher & First Aid kit present"
atY:640]];
[checkboxes addObject:[self createCheckboxWithLabel:#"Wheel nuts checked with torque wrench"
atY:690]];
}
for(WpCheckboxWithLabelView *checkbox in checkboxes){
[scrollView addSubview: checkbox];
}
// Set content size of scrollview
scrollView.contentSize = CGSizeMake(0, 10000);
scrollView.delegate = self;
NSLog(#"scrollView frame size: %f,%f", scrollView.frame.size.width, scrollView.frame.size.height);
NSLog(#"scrollView content size: %f,%f", scrollView.contentSize.width, scrollView.contentSize.height);

I have the same thing in one my views and it works fine for me. I attached the code:
CGSize s = CGSizeMake(mainDetailView.frame.size.width,
view1.frame.size.height + MARGIN +
view2.frame.size.height + MARGIN +
view3.frame.size.height + MARGIN +
view4.frame.size.height + MARGIN + 10000);
[mainDetailView setContentSize:s];
mainDetailView.clipsToBounds = NO;
mainDetailView.pagingEnabled = NO;
The Margin is a constant that I defined to be 20.
I can scroll beyond the limit of the views.
Maybe you can post your code and will be easier to help you.

Auto layout was the cause of the issue here. I'm not exactly sure of the details, but Apple's documentation describes the behavioural differences of UIScrollViews when paired with autolayout.
I believe my issue was due to the scrollview being defined in the storyboard and subviews added programatically. To solve the issue I created the UIScrollView programatically as well.

Related

TinyMCE 5 - How to control which buttons are shown in toolbar?

I have to remove some buttons from the tinyMCE 5 Editor.
How can I control which buttons are being shown?
I can't find anything in the documentation.
This is my init code:
tinymce.init({
selector: 'textarea.property_remark'
,branding: true
,menubar: false
,statusbar: true
,toolbar: true
});
I found it here
tinymce.init({
selector: 'textarea.property_remark'
,branding: true
,menubar: false
,statusbar: true
,toolbar: 'undo redo | styleselect | bold italic | link image'
});
In order to use certain toolbar buttons or menu options you need to load some plugins. check this link

SSRS - Toggling visibility of report items based on the visibility state of other report items

I'm trying to make a report in SSRS, and I'd like to toggle the visibility of sections of the report if one section of the report is visible or not.
If section1 is visible
then section2, section3, section4 are hidden;
If section2 is visible
then section1, section3, section4 are hidden;
If section3 is visible
then section1, section2, section4 are hidden;
If section4 is visible
then section1, section2, section3 are hidden;
Is there a way of doing this?
Thanks in advance,
Nick
Wouldn't you want to define which one is visable using a variable or hidden parameter?
I'd set a parameter with four options 1, 2, 3 and 4, then depending on which one is selected set the visability of the other section individually. E.g. if you used an expression in the visability property of section 1 to =iif(Paramater!Section_Visable.Value=1, false, true)

scrollToVisible error while testing on a device, UIAutomation

For this line of test code : view.scrollViews()[0].tapWithOptions({tapOffset:{x:0.32, y:0.25}})
I am getting this error
2012-11-02 18:09:23 +0000 None: Script threw an uncaught JavaScript error: target.frontMostApp().mainWindow().scrollViews()[0] could not be tapped on line 244 of feature.js
2012-11-02 18:09:23 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0].tapWithOptions({tapOffset:{x:"0.32", y:"0.25"}})
2012-11-02 18:09:23 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0].scrollToVisible()
2012-11-02 18:09:23 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0] - scrollToVisible cannot be used on the element because it does not have a scrollable ancestor.
2012-11-02 18:09:23 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0] - scrollToVisible cannot be used on the element because it does not have a scrollable ancestor.
2012-11-02 18:09:23 +0000 Debug: target.frontMostApp().mainWindow().scrollViews()[0] could not be tapped
The logelement tree looks like this
UIATarget "MyiPadname" {{0, 0}, {1024, 768}}
elements: {
UIAApplication "myAppName" {{0, 0}, {1024, 768}}
elements: {
UIAWindow "(null)" {{0, 0}, {1024, 768}}
elements: {
UIAScrollView "(null)" {{0, 0}, {1024, 768}}
elements: {
UIAImage "(null)" {{1017, 761}, {7, 7}}
UIAImage "(null)" {{1017, 761}, {7, 7}}
}
UIAImage "nav_bar.png" {{0, 724}, {1024, 44}}
UIAButton "button featured" {{0, 730}, {134, 39}}
UIAButton "See the world" {{134, 730}, {223, 39}}
UIAButton "button my favorites" {{357, 730}, {180, 39}}
UIAButton "button settings" {{967, 736}, {33, 27}}
}
}
}
I am using XCode 4.5.1 . Can anyone help me to fix this . Thanks
Are you, by any chance, using iOS 5.x simulator or iOS 5.x device? If yes then I am seeing the same issue. I believe Xcode 4.5.1 does not like ScrollViews.
But, I found a workaround.
My element is looks like :
target.frontMostApp().mainWindow().scrollViews()[0].buttons()["Wikipedia"]
So, instead of accessing the button directly, I am trying to access a staticText for the button.
target.frontMostApp().mainWindow().scrollViews()[0].buttons()["Wikipedia"].staticTexts()["Wikipedia"].tap();
I hope this works for you.
I am getting the same error when doing flickInsideWithOptions on a scroll view. I believe that the automation framework is trying to scroll to the element you want to tap first but if the scrolling is disabled for some reason, it fails with the error you mentioned.
There is only one way how to fix it - the automation framework can't know that we are tapping into a scroll view - we have to avoid its special versions of the tap/swipe/flick functions. We will tap on mainWindow instead, e.g.
var buttonRect = button.rect();
var windowRect = mainWindow.rect();
var xPos = (20 + buttonRect.origin.x) / windowRect.size.width;
var yPos = (50 + buttonRect.origin.y) / windowRect.size.height;
mainWindow.tapWithOptions({tapOffset:{x:xPos, y:yPos}});

Tinymce resize vertical only

Is there anyway to force tinymce to resize vertical only? It breaks my layout when resized horizontal.
So that this works the same as a default textarea resize: vertical;
tinymce.init({
selector: 'textarea', // change this value according to your HTML
resize: true
});
resize option has 3 values:
false: to disable.
true: enable only Vertical resize
'both': enable both resize directions
check the Documentation
IMPORTANT NOTE: to make it work you have to enable the statusbar option, it's enabled by default, but in case if turned it to statusbar: false you will have to re-enable it statusbar: true
you can use:
tinyMCE.init({
// other stuff...
theme_advanced_resizing : true,
theme_advanced_resize_horizontal : false
});

extjs 3 - card layout doesn't work in tabpanel

I am using tabpanel with card layout. When i open the tab for the first time everything works fine. but when i close (hide) the tab and then reopen it then i can no longer navigate between cards
// Hide tab
tab.hide();
tabpanel.hideTabStripItem(tab);
// Reopen tab
tabpanel.unhideTabStripItem('mytab');
tabpanel.setActiveTab('mytab');
// Panel = objPanel
{
xtype: 'panel',
layout: 'card',
layoutConfig: {
deferredRender: true
},
activeItem: 0,
border: false,
plain: true,
items: [
...
]
}
// Switching between cards
objPanel.getLayout().setActiveItem(0); // or 1
The thing is objPanel.getLayout() gives "card" (string) after reopening the tab instead of an object.
Can anyone suggest any solution for this? Thanks for any help.
I am not sure what causes this problem but when i changed dataview to gridpanel, everything is working fine.
Following is how my layout was - when i wasn't able to reopen a tab:
form panel
displayfield
panel with card layout
dataview 1 - card 0
dataview 2 - card 1
New layout - where i am able to reopen the tab:
form panel
displayfield
panel with card layout
grid - card 0
dataview 2 - card 1