uikit

Auto Scrolling UITextView Problem

﹥>﹥吖頭↗ 提交于 2019-12-12 05:37:19
问题 I am trying to auto scroll my text view and reset it to the top once it's arrived at the end. I use this code: -(void)scrollTextView { CGPoint scrollPoint = stationInfo.contentOffset; scrollPoint = CGPointMake(scrollPoint.x, scrollPoint.y + 2); if (scrollPoint.y == originalPoint.y + 100) { NSLog(@"Reset it"); scrollPoint = CGPointMake(originalPoint.x, originalPoint.y); [stationInfo setContentOffset:scrollPoint animated:YES]; [scroller invalidate]; scroller = nil; scroller = [NSTimer

How to programmatically change a UIView's “origin” (as labeled in Xcode)?

試著忘記壹切 提交于 2019-12-12 05:25:15
问题 You will notice the red "+" / "arrows" glyph in the attached screenshot. It is easy enough to change this "origin" point in Xcode. Is there also a way to do this programmatically or is this entirely an Xcode abstraction? For instance, I want to programmatically create a UILabel and position it by calculating the lower right hand coordinate. In Xcode, I would simply make sure that the red "+" is on the bottom right grid point and define the X, Y, Width and Height parameters with that "origin"

How to programmatically change UITabBar selected index after Dismiss?

南笙酒味 提交于 2019-12-12 05:14:41
问题 I have a modal UIViewController over the UITabBarViewcontroller and i want to dismiss it, then change the selected item of my tab bar. I'm trying to accomplish it by setting the selectedIndex inside dismiss' completion: self.dismiss(animated: true, completion: { self.tabBarController?.selectedIndex = 2 }) I apologize if this is a newbie question, i just couldn't find the solution to this anywhere. Thanks in advance for every answer, clue or old similar questions that you send me :) 回答1: I was

UITableView in table view's headerView

走远了吗. 提交于 2019-12-12 05:12:00
问题 Relating to UITableView sections to always stay within view but I got an idea I'm not sure of: Has anyone ever tried to nest a UITableView in another UITableView , whether by putting the second one as the tableHeaderView or as a section header of the first one? 回答1: UITableView is derived from UIScrollView . It is generally not a good idea to have a scroll view inside a scroll view (exception: when the scrolling directions are perpendicular to each other). Otherwise you would end up with a

Implementing UIWebView inside UIScrollView

◇◆丶佛笑我妖孽 提交于 2019-12-12 04:56:43
问题 I'm trying to use UIWebView inside UIScrollView, I want to display an webview under an image and make them scrollable. So I flowed those step : Desactivate the Scroll Property for UIWebView Set the UIScrollView and UIWebView height equals to content size. And this my code : - (void)viewDidLoad { [super viewDidLoad]; self.contentReader.scrollView.scrollEnabled = NO; NSString *myDescriptionHTML = [NSString stringWithFormat:@"<html> \n" "<head> \n" "<style type=\"text/css\"> \n" "body {font

UIPinchGestureRecognizer only for pinching out

一个人想着一个人 提交于 2019-12-12 04:37:17
问题 I'm trying to create a UIPinchGestureRecognizer that fails if the user pinches out (moves there fingers apart). I know there is a really easy way to do this by just taking the scale of t he recogniser in the action method and if it is larger than 1, set a flag and ignore all the future calls. However, this does not work for me, I have other gesture recognisers that require this pinch recogniser to fail, so I need it to fail properly when the user pinches in the wrong direction. I have

How to make a view controller without a xib or a storyboard vc identifier?

喜你入骨 提交于 2019-12-12 04:19:03
问题 I wanted to know how to make a viewcontroller without the use of xib or storyboard . So in this case, I would be getting the viewcontroller as such PopupViewController* vc = [[PopupViewController alloc] init]; [self addChildViewController:vc]; [self.view addSubview:vc.view]; [vc didMoveToParentViewController:self]; I know it has to do something with overriding the init method since we are not using initWithCoder ? I know I have to create a view and set it as the self.view for the

Cannot call value of non-function type 'CGFloat' with the alpha property

烂漫一生 提交于 2019-12-12 04:16:18
问题 I am debugging a dropdown menu I converted from Objective-C. In it, I have this function: func showMenu() { self.menu.hidden = false self.menu.translatesAutoresizingMaskIntoConstraints = true closedMenuShape.removeFromSuperlayer() if shouldDisplayDropShape { self.view.layer.addSublayer(openMenuShape) } // Set new origin of menu var menuFrame: CGRect = self.menu.frame menuFrame.origin.y = self.menubar.frame.size.height - self.offset() var containerAlpha: CGFloat = fadeAlpha if SYSTEM_VERSION

Adding text field dynamically when clicked on button in Objective-C

痞子三分冷 提交于 2019-12-12 03:55:49
问题 I have a text field with button pickerView functionality. if(pickerView==selectItemListPickerView) { selectITemListTxtFld.text = [itemListSplitDisplayArray objectAtIndex:row]; } Now I want to display this functionality in another dynamically created text field each time when I click on add button. I tried it like this. UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(18, 350, 309, 35)]; textField.borderStyle = UITextBorderStyleRoundedRect; textField.font = [UIFont

NSFetchedResultsController notifies its Delegate of delete changes when a managed object is modified, and never notifies for Insert or Update

我只是一个虾纸丫 提交于 2019-12-12 03:29:26
问题 I have a UITableViewController , which is a delegate for an NSFetchedResultsController . My NSFetchedResultsControllerDelegate functions are set up as per "Typical Use" in Apple's documentation, with the table view controller as the fetched result controller's delegate property. I also have some view controllers which are presented on top of the table view where the managed objects can be modified. These modifications are done on the same managed object context. There is only one managed