how to prevent resizing subview outof superview [closed] - ios

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
A UIImageView object is in UIView.
UIImageView *foreview = //
UIView* backview = //
/* some preccess */
[backview addSubView:foreview];
Thus foreview is backview's subview.
I am going to resize and rotate the backview so that don't out of foreview.
How to code?

You can set superview.clipsToBounds=YES so that it will clip the subviews which goes out of bounds.

subviews will rotate with superview automatically.
if you don't want foreview rotate with backView, you shouldn't add it as subview.

Related

Add many button in Xib in iOS [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I have requirement to add many button large size but its not coming within view bound what should i implement .
You can do it like this,
First in xib file add scrollview in your main view and than get another view in your screen which have large size dont add it to your main view but create different panel near it and than connect both scrollview and large contentview in .h file like this,
First in xib file
In .h file connect both contentView and scrollView,
#property (strong, nonatomic) IBOutlet UIView *contentView;
#property (strong, nonatomic) IBOutlet UIScrollView *scrollview;
Than in .m file add contentView to scrollView and make scrollview size to fit contentView,
- (void)viewDidLoad
{
[super viewDidLoad];
[scrollview addSubview:self.contentView];
scrollview.contentSize = self.contentView.frame.size;
}
You should use scrollview and then add those button in that scrollview. ScrollView is used when you have to use controls whose size is greater then your screen size.
You can increase its content size.
Hope it helps you.

How to scroll cells only and not the entire tableview? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
How do you disable tableview scrolling but enable cells to scroll within the section similar to how path for iPad does their friend and and notification cells, they are collapsable but the cells under the section only scroll within the section as in the section does not move to the top of the device but remains in its position.
There is no such controls available in iOS.
Possibly it is a customized UITableView. According to your description, each section of that table will contain another UITableView not simple UITableViewCell. That's why it have the feature you specified.
I had seen some open-source controls with similar feature, but forgot the name of those controls.
Your question is too broad, its better if you can add more details. But I will give you a rough answer to my understanding of your problem. What you can do is use UITextView in side your tableview cell and depending on the scenarion you can disable the scroll. It is recommended you keep only one scroll view scrollable at one time. UITableView is also inherits from UIScrollView. You can set the scroll disabling to your gesture handle methods or in a expanded cell scenario. To set scroll disable you can set scrollEnabled property to no.
Refer to http://developer.apple.com/library/ios/#documentation/uikit/reference/UIScrollView_Class/Reference/UIScrollView.html#//apple_ref/occ/cl/UIScrollView

iOS. Apply another scroll animation when UIScrollView is scrolling [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I have UIScrollView with verticall scroll and a button which doesn't belong this scrollview and calls animated moving of this scrollview aside (not scrolling).
If I touch up this button and the scrollview is scrolling at the same time then app waits when the scrollview's animation is finished and then calls the animation from the button.
How to make these animations working simultaneously?
Or maybe are there any ways to stop all the scrollview animations except of checking all the subviews (because there are could be a lot of various scrollviews)?
Solved by calling an animation directly without performSelector:withObject:afterDelay:
But sometimes this wouldn't work

How to make a tableView that can slide horizontal? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I want a tableView that slide horizontal.
Just look like what scrollView can do.
Can I?Thx
Please have a look at this link
- (void)easyTableView:(EasyTableView *)easyTableView setDataForView:(UIView *)view forIndexPath:(NSIndexPath *)indexPath
By calling the above method you can do it.
You can achieve this by adding UITableView in UIScrollView. Extend the UITableView width how much you want and set UIScrollView Content size as same as UITableView frame( width and height) in implementation file.Then run your code.I hope this will work.Please let me know if you have any queries.

Repositioning programmatically added uibuttons on orientation change [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I'm programmatically adding UIButtons to my view and I want to reposition them based on the orientation change.
I'm creating buttons by running 2 for loops for rows and cols and within the second for loop:
I'm assigning some properties and unique tags for each button. (Ex. Best way to build 10x10 grid of UIButtons?)
I'm detecting orientation change by listening to willAnimateRotationToInterfaceOrientation and was hoping to call buttons by based on their tag to move them to a new position.
I need to keep the state of the buttons so I can't remove them. It has to be repositioned.
Any suggestions? Thanks.
There are three ways to do this.
1) Using Autoresizing masks: Using this approach you need not do anything and the buttons automatically reposition based on the autoresizing masks set for the button with respect to its superview.
2) Second approach is to reposition the button after the rotation of the super view. You can write a method to calculate the new frame for the button based on the new width and height of its super view after rotation. There are rotation callbacks like
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
3) You can also implement below method in button's superview and reset the frames of your button
- (void)layoutSubviews
Hope this helps.
Use this:
UIButton *button = (UIButton *)[self.view viewWithTag:1]; // change viewWithTag to your buttons tag number. Now you can use button to position it anyway you want.
button.frame = CGRectMake(x, y, w, h); // x, y, width, height

Resources