Comments (6)
Can you show me your full code?
I have updated the demo code,in file of CustomerViewController.m,but did not encounter the problem you said.
My english is poor, I do't know if you can understand what I said.
from fmtagsview.
your english is fine, don't worry!
My problem is that I need to resize the frame after I draw the tags because I don't know the number of tags and probably is more or less than the initial given size (in your example the height is 190). I programmatically put the tagView in a scrollView and after drawing the tagView, the height is too much and it doesn't resize.
how can I make the view resize after I draw it and fit the real used height?
Thank you
from fmtagsview.
It's my control's bug. You must set the tagsView with the correct width.
- (FMTagsView *)createTagsViewWithDataSrouse:(NSArray *)dataSource borderColor:(UIColor *)borderColor {
CGFloat screenWidth = [UIScreen mainScreen].bounds.size.width;
CGFloat padding = 15;
//must set the correct width
FMTagsView *tagsView = [[FMTagsView alloc] initWithFrame:CGRectMake(0, 0, screenWidth - padding * 2, 180)];
tagsView.backgroundColor = [UIColor whiteColor];
tagsView.delegate = self;
tagsView.contentInsets = UIEdgeInsetsMake(10, 10, 10, 10);
tagsView.tagcornerRadius = 0;
tagsView.layer.borderColor = borderColor.CGColor;
tagsView.layer.borderWidth = 1;
tagsView.tagsArray = dataSource;
return tagsView;
}
The code has been updated, wish to help you.
from fmtagsview.
so basically the magic happens because of the Costraints part. I commented a piece of your code and this is what I had already reported at the beginning:
The tagview height is exactly 180 like configured at the beginning.
Is there any way to set the constraints dynamically?? I'm working with dynamic zones and I don't have label1, label2, label3.. Sorry but I'm very new to objective c and constraints are still really hard to understand.
What if I didn't use constraints? how can I resize the view without those?
from fmtagsview.
Becasue the scrollview's contentSize is determined by its internal subviews, in my code, the scrollContentView's size is determined by its subviews, and the scrollView's contentSize is determined by the scrollCotentView
.
[self.scrollContentView mas_makeConstraints:^(MASConstraintMaker *make){
make.bottom.equalTo(self.tagsView3.mas_bottom).offset(10);
}];
I have add a new method called changeDataSource
in my latest code, this change the tagsview's height dynamically, As shown below:
I recommend you some information to learn Autolayout:
- Using UIScrollView with Auto Layout in iOS
- AutolayoutExampleWithMasonry
- Beginning Auto Layout Tutorial in iOS 7: Part 1
- Beginning Auto Layout Tutorial in iOS 7: Part 2
from fmtagsview.
thank you so much for your help! since I dynamically created the views, I ended up doing something as simple as this:
`for (int x =0;x<arrayView.count;x++) {
if (x-1>=0) {
UIView *previousView = arrayView[(NSUInteger) (x-1)];
UIView *currentView = arrayView[(NSUInteger) (x)];
[currentView mas_makeConstraints:^(MASConstraintMaker *make){
make.top.equalTo(previousView.mas_bottom).offset(15);
make.left.equalTo(previousView);
}];
}
}`
not sure if there is any better way to achieve this, but this is good as a beginning!
from fmtagsview.
Related Issues (12)
- 添加频道功能 HOT 3
- - (BOOL)tagsView:(FMTagsView *)tagsView shouldDeselectItemAtIndex:(NSUInteger)index;不执行 HOT 1
- is there any way to specify the color for each tag? HOT 1
- 已解决
- 建议添加长按删除功能 HOT 1
- 是否能实现动态返回collectionView 的 contentSize 高度 HOT 1
- 如何根据数据源动态设置高度呢? HOT 1
- 多选时,取消选择然后重新选,依然会执行超过最多限制的代理。 HOT 1
- tableView cell里面如何动态高度,使用的是Masonry布局 HOT 1
- 多选状态下,代理是否点击不响应 HOT 2
- DELETED
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fmtagsview.