My horizontalScrollView is shown noraml.now,I lock the screen,and then open it,the horizontalScrollView is disappeared.but on gingerbread it works well.what's the reason?anyone can help me?
here is the java code:
View view = LayoutInflater.from(this).inflate(R.layout.shop_bottom_tips, null);
RelativeLayout shopLayout (RelativeLayout)view.findViewById(R.id.shop_tips_layout_id);
AsyncImageView imageView = (AsyncImageView) view.findViewById(R.id.shop_tips_img_id);
for(...) {
//add child to the view.
}
layout code:
<HorizontalScrollView
android:id="#+id/horizontalScrollView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="none" >
<LinearLayout
android:id="#+id/poster_shop_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
</LinearLayout>
</HorizontalScrollView>
Related
I'm currently transiting my application to iOS 7 (I want it to remain iOS 6 compatible). This question is not covered by the Apple NDA, it is a question about Auto Layout (it seems that iOS 7 forces Auto Layout (EDIT : was wrong, it is not forced)).
I have a navigation controller with a root view controller (obvious). With iOS 6, i was not using Auto Layout, so the root view controllers was below the navigation bar. With iOS 7, the frame origin does not include the navigation bar, so the top part of my content is hidden...
Have you an idea how to make the entire view above the navigation bar with Auto Layout ?
Thanks !
On iOS 7 you have the topLayoutGuide that specify the navigation bar. You can then specify that you want that the constraint of the tableview is on the topLayoutGuide and not the superview.
This will help you to know if it's iOS7 or not:
if ([self respondsToSelector:#selector(topLayoutGuide)])
So it can be something like that
NSString *verticalConstraint = #"V:|[v]|";
NSMutableDictionary *views = [NSMutableDictionary new];
views[#"v"] = self.tableview;
if ([self respondsToSelector:#selector(topLayoutGuide)]) {
views[#"topLayoutGuide"] = self.topLayoutGuide;
verticalConstraint = #"V:[topLayoutGuide][v]|";
}
[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:verticalConstraint options:0 metrics:nil views:views]];
[self.view addConstraints:constraints];
Here is a problem. I am using a draggable image in UIWebview. The Source code: here:http://ios-blog.co.uk/tutorials/rich-text-editing-a-simple-start-part-7/
It simply disables the scrolling during drag and reenable it when the dragging is completed.
It works perfectly fine when UIWebview is first brought up and hereafter. As soon as the edited text length is longer than the screen. UIWebview ignores the scroll setting of its scrollview and re-enables the scrolling.
The way I disable the scroll view is using this:
webview.scrollview.scrollEnabled = NO;
Please tell me where I was wrong. Much appreciated.
This problem is caused because of the following wrap placed within the html file I loaded as a template editing section.
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"/>
<style type="text/css">
html, body {height: 100%;}
body {
margin: 0;
}
#wrap {
height: 100%;
width: 100%;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
}
#content
padding: 10px;
}
</style>
Any div wrapped with this block will always allow itself to be scrolled.
Deleted it and things turned out to function properly again!
may use
for(UIView *aView in webview.subviews){
if([aView isKindOfClass:[UIScrollView class]])
aView.scrollEnabled = NO;
}
this makes sure that any scrollview's scrolling is disabled.
I have a problem with an NSView's subview. I'm trying to use an NSArray to retrieve [myView subviews] (in which I have only one view) and I want to remove this subview but I don't know how to do it. I have tried
NSArray *subviews = [self.mainView subviews];
[self.mainView replaceSubview:subviews[0] with:[self.mainViewController view]];
but XCode crashes and I get this log into the console :
-[NSEvent subviews]: unrecognized selector sent to instance 0x102202aa0
I don't know what the problem is....
So if some of you could help me, that would be very kind...
Well, shame on me !
I was actually looking for a problem at the wrong place...
What I ended up doing is this : I have two subviews in my mainView, the one at index 0 is a background NSimageView (which I want to keep) and the second one (at index 1) is the one I want to replace.
So here's the solution :
NSArray *subviews = [self.mainView subviews];
NSView *secondSubView = [subviews objectAtIndex:1];
[self.mainView replaceSubview:secondSubView with:[self.myViewController view]];
Enjoy !
In iPhone application I want to generate a image of UIScrollView whose content size is near about 600*41000. If I use current graphic image context to capture the scroll view layer, then it only captures the visible part of the scroll view not the whole layer of that scroll view.
I am using the below code:
{
UIGraphicsBeginImageContext(CGSizeMake(600, 4100));
[scrollView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(00, 100, 710, 4100)];
img.image = viewImage;
[anotherScrollView addSubview:img];
}
Try to generate image not from UIScrollView but from its content view. When you add some views to UIScrollView with something like addSubview: they become scroll's content ones. Of course, UIScrollView can have more than one content view (just as any UIView can have more than one subview) and this case it will be more difficult to render its layer. But in case of only one subview (content view) you can use something like (contentView here is just some view, added to UIScrollView before):
[contentView.layer renderInContext:UIGraphicsGetCurrentContext()];
or:
[[[[scrollView subviews] lastObject] layer] renderInContext:UIGraphicsGetCurrentContext()];
When you want to use more than one view, it will be easier (I think) to add one more "root" view and add others as that view's subviews: so you can also use the code above.
I have a View including a Toolbar and a WebView
UIVIEW
UIToolbar
UIWebview
Now i like to make a screenshot ONLY from the WebView with:
UIGraphicsBeginImageContext(articleWebView.window.bounds.size);
[articleWebView.window.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
But always ImageCapture starts from the TOP of the Screen.
So it includes the Toolbar (even 20 empty pixel at the top from the Statusbar)
How can I just capture the Image thats actual in my UIWebView?
Thanks Chris
Your UIWebView is backed by its own layer, so you should be able to just grab the currently displayed contents for it:
UIGraphicsBeginImageContext(articleWebView.bounds.size);
[articleWebView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();