IOS 小问题笔记

UINavigationController 设置半透明

navigation.navigationBar.translucent =YES;

 获取根视图 
 

[UIApplication sharedApplication].keyWindow.rootViewController

获取根视图代理类

[UIApplication sharedApplication].delegate

[UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.3f];
    [UIView setAnimationCurve:UIViewAnimationCurveLinear];
    
    [myDelegate.leftView setFrame: leftRect];
    [rootViewController.view setFrame: rightRect];
    
    [UIView commitAnimations];

折纸效果动画

http://code4app.com/ios/XYOrigami/4fcc23166803fa6337000000

UIScrollView滚动到指定位置

[mScrollView setContentOffset:CGPointMake(0, 200) animated:YES];


IOS添加左右手势

// 添加手势
    UISwipeGestureRecognizer * swipeGestureLeft = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(leftBarClick:)];
    swipeGestureLeft.direction = UISwipeGestureRecognizerDirectionLeft;
    self.swipeGestureLeft=swipeGestureLeft;
    
    UISwipeGestureRecognizer * swipeGestureRight = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(leftBarClick:)];
    swipeGestureRight.direction = UISwipeGestureRecognizerDirectionRight;
    self.swipeGestureRight=swipeGestureRight;
    [self.view addGestureRecognizer:swipeGestureLeft];
    [self.view addGestureRecognizer:swipeGestureRight];


只支持竖屏

1.在工程里面找到Supporting Files文件夹;

2.找到文件夹下面的XXXX-Info.plist,选中打开;

3.找到Supported interface orientation,会发现里面除了支持竖屏还支持其他方向


4.选中item0,会发现有“+”和“-”,选中“-”将item0删除

5.对item1进行同样的操作,让最后只剩item2.那么工程中所有的页面就只支持竖屏了



动态修改navigationbar显示与否

self.navigationController.navigationBar.hidden = NO;

UIScroView设置滚动没有惯性 bounces

(1)当bounces属性设置为YES时,当UIScrollView中图片滑动到边界的时候会出现弹动的效果,就像是Linux中的果冻效果一样。

(2)当bounces属性设置为NO时,当UIScrollView中图片滑动到边界时会直接定在边界就不会有弹动的效果。

点击UITextField显示键盘,并且在键盘上面显示一个视图

textField.inputAccessoryView = inputView;
[textField becomeFirstResponder];

状态栏loading状态

[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

UITableView不显示分割线

tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

你可能感兴趣的:(IOS 小问题笔记)