Java EE数据层框架(Java EE Data layer frameworks)
我试图找出Java EE应用服务器上数据层上使用最广泛的框架。
我想知道哪些在哪里使用,以及它们的优点和缺点。
I am trying to figure out what are the most widely used frameworks on the data layer on a Java EE application server.
I would like help in knowing which are used out there and what are their Pros and Cons.
原文:https://stackoverflow.com/questions/2347881
最满意答案
我已经在我的代码中实现了完全相同的功能,可以像控制一样复制android ...
请查看我的代码的某些部分,您将获得一些想法
我通过向UIScrollView添加Views来完成它。 使用2个滚动视图,一个用于标题,一个用于表
1.将表视图添加到表的scrollview
pageNo = 1;
for (Page *page in pageArray) { UIStoryboard *mystoryboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil]; PageContentViewController *contentViewController = [mystoryboard instantiateViewControllerWithIdentifier:@"pageContentViewController"]; contentViewController.detailsDictionary = page.deviceDetailDictionary; //assigning dictionary will use as table data source /* Content page's x position calculation */ // Formula: xPos = scrollViewWidth * ( pageNo -1 ) // Where, // pageNo starts with 1 int xPos = self.detailScrollView.frame.size.width * (pageNo -1); contentViewController.view.frame = CGRectMake(xPos, 0, self.detailScrollView.frame.size.width, contentViewController.view.frame.size.height); pageNo ++; [self addChildViewController:contentViewController]; [self.detailScrollView addSubview:contentViewController.view]; [contentViewController didMoveToParentViewController:self]; }
2.将UILabel添加到titleScrollView
只需检查此公式即可将标题UILabel视图添加到顶部滚动视图
// Formula: xPos = 75 + 10 * pageNo + (pageNo -1) * 150; // Where, // pageNo starts with 1 // 75 = Left margin of first title // 10 = Space between two labels // 150 = Width of label
3.使用ScrollView的Delegate方法(在其中添加了表格)来处理滑动
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView; { CGFloat pageWidth = self.detailScrollView.frame.size.width; //1. Calculate page no. if 50 percent or more area of any page visible make it as current page int pageNo = floor((self.detailScrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 2; //2. Make only current page (calculated in 1.) visible by scrolling to that page in detailScrollView //Formula : xPos = pageWidth * (pageNo -1) CGRect frame = CGRectMake( pageWidth * (pageNo -1), 0, pageWidth, 50); [self.detailScrollView scrollRectToVisible:frame animated:YES];//OR set content offset //3. Make title visible of current page by scrolling to that title in titleScrollView //Formula : xPos = (pageWidth / 2) * (pageNo -1) CGRect titleFrame = CGRectMake( 160 * (pageNo -1), 0, pageWidth, 10); [self.titleScrollView scrollRectToVisible:titleFrame animated:YES];//OR set content offset //Fade effect for non current titles //Set all page title alpha to low value for (UILabel *title in pageTitleArray) { [title setAlpha:0.5]; } //set current page alpha to 1 UILabel *title = [pageTitleArray objectAtIndex:pageNo -1]; [title setAlpha:1]; }
3中的代码负责在动画滑动时移动到next / prev页面
希望这对你来说是一个很好的起点......
I have implemented exact same in my code which replicates android like control…
Please see some part of my code you will get some ideas
I have done it by adding Views to UIScrollView. Used 2 scrollviews one for title and one for tables
1. Adding table views to scrollview for table
pageNo = 1;
for (Page *page in pageArray) { UIStoryboard *mystoryboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil]; PageContentViewController *contentViewController = [mystoryboard instantiateViewControllerWithIdentifier:@"pageContentViewController"]; contentViewController.detailsDictionary = page.deviceDetailDictionary; //assigning dictionary will use as table data source /* Content page's x position calculation */ // Formula: xPos = scrollViewWidth * ( pageNo -1 ) // Where, // pageNo starts with 1 int xPos = self.detailScrollView.frame.size.width * (pageNo -1); contentViewController.view.frame = CGRectMake(xPos, 0, self.detailScrollView.frame.size.width, contentViewController.view.frame.size.height); pageNo ++; [self addChildViewController:contentViewController]; [self.detailScrollView addSubview:contentViewController.view]; [contentViewController didMoveToParentViewController:self]; }
2. Add UILabels to titleScrollView
Just check this formula to add title UILabel views to top scroll view
// Formula: xPos = 75 + 10 * pageNo + (pageNo -1) * 150; // Where, // pageNo starts with 1 // 75 = Left margin of first title // 10 = Space between two labels // 150 = Width of label
3. Use Delegate method of ScrollView (in which you added table) to handle swipes
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView; { CGFloat pageWidth = self.detailScrollView.frame.size.width; //1. Calculate page no. if 50 percent or more area of any page visible make it as current page int pageNo = floor((self.detailScrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 2; //2. Make only current page (calculated in 1.) visible by scrolling to that page in detailScrollView //Formula : xPos = pageWidth * (pageNo -1) CGRect frame = CGRectMake( pageWidth * (pageNo -1), 0, pageWidth, 50); [self.detailScrollView scrollRectToVisible:frame animated:YES];//OR set content offset //3. Make title visible of current page by scrolling to that title in titleScrollView //Formula : xPos = (pageWidth / 2) * (pageNo -1) CGRect titleFrame = CGRectMake( 160 * (pageNo -1), 0, pageWidth, 10); [self.titleScrollView scrollRectToVisible:titleFrame animated:YES];//OR set content offset //Fade effect for non current titles //Set all page title alpha to low value for (UILabel *title in pageTitleArray) { [title setAlpha:0.5]; } //set current page alpha to 1 UILabel *title = [pageTitleArray objectAtIndex:pageNo -1]; [title setAlpha:1]; }
Code in 3 takes care of moving to next / prev page on swipe with animation
Hope this will be good starting point for you...
相关问答
更多-
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
@property (nonatomic, strong) UICollectionView *collectionView; - (void)viewDidLoad { [super viewDidLoad]; UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; self.collectionView = [[UICollectionView alloc] initWit ...
-
在ScrollView中的UITableViews根本不推荐作为它自己的scrollView作为子视图的UITableView。 这两个部分需要是基于行的,并且在高度上是动态的,因为它们内部的内容将会不同。 使用代表动态高度的行有什么错误 func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {} 一些教程: https : //www.raywenderlich.com/12905 ...
-
如果你想获得UICollectionView教程,那么这是官方文档 ,也是这个 如果你想获得自定义UICollectionView那么这是有史以来最好的网站。 祝一切顺利 :) If you want get tutorial of UICollectionView then this is Official Document and also This one And IF you want to get custom UICollectionView then This is the best site ...
-
尝试使用以下UICollectionViewDelegate函数: - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath; 如果您选择了该选项,则可以使用以下函数来处理它: - (void)selectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPo ...
-
这对我有用:请看附带的GIF。 我添加了与scrool指示器平行的蓝色自定义uiview。 我尝试了表视图,但这也适用于集合视图。 -(void)scrollViewDidScroll:(UIScrollView *)scrollView{ dispatch_async(dispatch_get_main_queue(), ^{ //get refrence of vertical indicator UIImageView *verticalIndicator = ...
-
图像没有显示在NSMutableArray的UICollectionView中(images not showing in UICollectionView from NSMutableArray)[2022-04-15]
你是在故事板中建立你的项目吗? 你创建的UICollectionViewCell和graniteImageView从[cell viewWithTag:100]返回的调试信息是什么? 确保将graniteImageView添加到单元格中,并且具有正确的框架,请检查您的单元格,并且图像是否有效。 Solved it! Was trying to be too organised with an image folder then sub folders for each category. When I mo ... -
ScrollView或UICollectionView中的UItableViews?(UItableViews in a ScrollView or UICollectionView? [closed])[2023-06-05]
我已经在我的代码中实现了完全相同的功能,可以像控制一样复制android ... 请查看我的代码的某些部分,您将获得一些想法 我通过向UIScrollView添加Views来完成它。 使用2个滚动视图,一个用于标题,一个用于表 1.将表视图添加到表的scrollview pageNo = 1; for (Page *page in pageArray) { UIStoryboard *mystoryboard = [UIStoryboard storyboardWithName:@"Main_iPh ... -
将水平scrollView添加到垂直滚动uicollectionView(add horizontal scrollView to vertical scroll uicollectionView)[2022-12-28]
您必须嵌套集合视图。 您需要在垂直滚动的集合视图中的单元格中放置水平滚动的集合视图。 iOS支持这种安排。 You have to nest the collection views. You'll need to put a horizontally-scrolling collection view in a cell in the vertically-scrolling collection view. iOS supports this arrangement. -
你应该总是调用超级方法。 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesBegan:touches withEvent:event]; NSLog(@"Began ==>"); } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesMoved:touches ...