Posts

Post not yet marked as solved
4 Replies
1.6k Views
I have an iOS application which is developed years ago and sets backgrounds of many controls using images.xcassets catalog. The images are set using contents.json in which targets are iPhone, iPad using 'idiom' key. Further specifications include 'scale' & 'filename'. Seems that this app worked fine until iOS 8.As of today there are many high screen resolution devices of iPhone, iPad. So, I need to add further more images targeting these high screen resolution devices.I don't know how it is handled earlier, but now there are different screen resolutions in the same scale factor. For e.g., iPad Pro 12.9" & iPad Pro 11" have '2x' as scale factor but has different resolutions '2048x2732' & '1668x2388' respectively. Now if I create an image targeting highest resolution 2048x2732, the image is not getting centered for resolution 1668x2388.Is there any particular key in contents.json that can differentiate screen resolutions/sizes for the same scale factor?When I search for Apple's documentation for asset catalog it is found in this documentation archive. Does that mean we shouldn't use asset catalog for images any more? Are there any latest standards for setting background images?
Posted Last updated
.
Post not yet marked as solved
0 Replies
548 Views
My app has a lengthy graph to be displayed where the X-Axis is marked with years ranging from 400 to 2100. The graph is drawn in a UIView and added as sub view to a UIScrollView. The axis is drawn with year markers using CGContextRef in drawRect (Code pasted below).Due to lengthy axis the width of graph's (UIView) frame is set to 10000. This graph is drawn without issues in medium screen resolution devices like iPad 2. However when this graph is opened in high resolution devices like iPad Air, issues like background not drawn (became transparent) and when scrolled the entire graph becomes messy due to contents redrawn without erasing previously drawn content.Even I have called following methods in 'setFrame' delegate but no use.[self setNeedsLayout]; [self setNeedsUpdateInRect:self.frame];Can anyone suggest drawing graphics in drawRect in efficient way to handle performance for high resolution devices?Following is my code in drawRect delegate:CGContextRef context = UIGraphicsGetCurrentContext(); [self.layer renderInContext:context]; CGPoint startPoint = CGPointMake(graphEndPadding, graphBaselineY); CGContextMoveToPoint(context, startPoint.x, startPoint.y); //Create line from starting point to end point CGPoint endPoint = CGPointMake(graphLengthPixels+graphEndPadding, graphBaselineY); CGContextAddLineToPoint(context, endPoint.x, endPoint.y); //Create hashmark point system CGFloat currX = startPoint.x; CGFloat yVal = startPoint.y + graphHashMarkLength; //Draw hashmarks int count = 0; while(currX <= endPoint.x) { //Draw hashmark CGContextMoveToPoint(context, currX, graphBaselineY); CGContextAddLineToPoint(context, currX, yVal); //Move to next hashmark currX += pixelYearIncrement; count++; } //Draw x-axis CGContextSetLineWidth(context, 1); CGContextSetLineCap(context, cgLineCapSquare); CGContextSetRGBStrokeColor(context, 0.7765, 0.6118, 0.4275, 1.0); CGContextStrokePath(context);
Posted Last updated
.
Post not yet marked as solved
0 Replies
1.1k Views
My application has a 'Search Bar' inside a UIView named as 'Container for Search Bar' which is again placed under a Navigation Bar. On the Interface Builder auto layout constraints are set between the search bar and UIView as shown below:First Item: Search Bar.Top Relation: Equal Second Item: Container for Search Bar.Top Constant: 0 Priority: 1000 Multiplier: 1First Item: Search Bar.Leading Relation: Equal Second Item: Container for SearchBar.Leading Constant: 0 Priority: 1000 Multiplier: 1First Item: Search Bar.Trailing Relation: Equal Second Item: Container for SearchBar.Trailing Constant: 0 Priority: 1000 Multiplier: 1The 'Container for Search Bar' (UIView) is set with width: 480 and Height: 44. Autoresizing for UIView is set to stretch and position relatively in all directions. The search bar is also set with width: 480.The UIView container is placed between back/forward buttons inside navigation bar. That's the reason the UIView container is set with 'Auto-Resizing' instead of setting auto layout constraints. As it is between two button items I think it can't be set with leading & trailing space constraints to its parentUntil IOS 10 the UIView and Search Bar stretched relatively based on the screen resolution of the device. However for IOS 12.1 version 'Search bar' becomes invisible at runtime. When I have debugged and checked the sizes, widths of both UIView and its child 'Search Bar' are set to 0 at runtime. When auto-layout constraints are removed then only the search bar is visible but not stretching according to screen resolution.Need help in solving this problem.
Posted Last updated
.
Post not yet marked as solved
0 Replies
1.4k Views
I have added a child UIViewController's view to a UIViewController on the storyboard from code instead of using segue. The custom UIViewController contains UISearchController. Following is the code I am using for adding the custom/child UIViewController:self.customController = [[CustomUIViewController alloc] init]; [self.searchBarContainerView addSubview:self.customController.view];'self.searchBarContainerView' in the above code is an UIView for displaying search bar of UISearchController. This code is working fine and the search bar is shown without issues at runtime. However when I am clicking inside search bar, following warning message is logged in the output window"presenting view controllers on detached view controllers is discouraged "I need help is fixing this warning from being shown.
Posted Last updated
.
Post marked as solved
3 Replies
5k Views
We have developed an application for iOS 5 long back where we used 'Search Bar and Search Display Controller' object on storyboard. Since iOS8 UISearchDisplayController is deprecated, I am trying to remove existing 'Search Bar and Search Display Controller' with UISearchController.As UISearchController is not available from 'Object Library' on interface, I have added it programatically to an UIView on interface using following code://Set up Search Controller self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; self.searchController.searchResultsUpdater = (id)self; self.searchController.dimsBackgroundDuringPresentation = YES; self.searchController.searchBar.delegate = self; //Adding as subview to UIView 'searchBarContainer' [self.searchBarContainer addSubview:self.searchController.searchBar]; [self.searchBarContainer bringSubviewToFront:self.searchController.searchBar]; self.definesPresentationContext = YES; self.extendedLayoutIncludesOpaqueBars = YES;And set the frame of 'searchController' equal to the UIView as follows:UISearchBar *ctrlSearchBar = self.searchController.searchBar; ctrlSearchBar.frame = CGRectMake(0, 0, self.searchBarContainer.frame.size.width, self.searchBarContainer.frame.size.height);The size of searchBar is fine but when it is focused on clicking on it, the width of 'searchBar' increased automatically. I even tried using NSLayoutConstraints but didn't fix the issue. Can anyone please help how to fix the size of 'UISearchController.searchBar' even when it is focused?
Posted Last updated
.