0920-0929 tableView返回頂部/上架流程/一些小功能

  1. 切換不同列表 使tableView返回頂部
[self.newsListTableView setContentOffset:(CGPointMake(0, 0)) animated:NO];
// UITableView 繼承自UIScrollView,setContentOffset是scrollView裏的一個方法
//另外  設置tableView的屬性 scrollsToTop = YES; 點擊狀態欄直接返回頂部
  1. iOS app上架流程 詳細
    http://www.jianshu.com/p/b1b77d804254
  2. 待解決 get請求返回一個數字,返回data形式轉換成字符串之後,結果正確,控制檯出現一句提醒:
    Incorrect NSStringEncoding value 0x8000100 detected. Assuming NSASCIIStringEncoding. Will stop this compatiblity mapping behavior in the near future.

4.
一,修改狀態欄:

1.加入[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];但此方法只是不顯示狀態條,狀態條所佔用的空間仍然存在。

2.可以修改Info.plist文件,在info.plist文件中加入一條新鍵值,命名爲:UIStatusBarHidden;選擇Valuetype爲Boolean,而後重新編譯運行。

3,修改屏幕顯示方向:

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];

4,得到項目的名字

//得到項目的名字,並設置在當前視圖標題上

self.title = [[[NSBundle mainBundle] infoDictionary] objectForKey:@”CFBundleName”];

5,設置當前視圖支持觸摸

setUserInteractionEnabled:YES;

6.Button.userInteractionEnabled=NO,按鈕停止接受任何事件

7.Button.Enabled=NO,按鈕不顯示

8.獲得當前鼠標的位置

[NSEvent mouseLocation];

9.刷新UITableViewrController視圖

[self.TableView reloadData];

10.

字符串轉化爲int

NSString的IntegerValue方法

11.整形轉化爲字符串爲StringWithFormat;

12.製作一個簡單的動畫:

  • (IBAction)curlAction:(id)sender

{

//開始一個動畫

[UIView beginAnimations:nil context:NULL];

//設置動畫得時間間隔

[UIView setAnimationDuration:kTransitionDuration];

//設置動畫得旋轉方式

[UIView setAnimationTransition:([self.mainView superview] ?

UIViewAnimationTransitionCurlUp : UIViewAnimationTransitionCurlDown)

forView:self.containerView cache:YES];

if ([self.flipToView superview])

{

[self.flipToView removeFromSuperview];

[self.containerView addSubview:self.mainView];

}

else

{

[self.mainView removeFromSuperview];

[self.containerView addSubview:self.flipToView];

}

[UIView commitAnimations];

}

13.使用隨機數

srandom()得使用

random((unsigned)(macn_absolute_time() &0xFFFFFFFF));

14。Quartz中是怎樣設置旋轉點得

UIImageView *imageview=[[UIImageview alloc] initWithImage:[UIImage imageNamed:@”bg.png”]];

imageView.layer.anchorPoint=CGPointMake(0.5,1.0);

15.隱藏NavigationBar

[self.navigationController setNavigationBarHidden:YES animated:YES];

16,根據CLLocation得到coordinate(座標)而後打開google地圖:

NSString *mapUrl=[NSString stringWithFormat:@”http://maps.google.com/maps?q=%f,%f“,loc.latitude,loc.longitude];

NSURL *url=[NSURL URLWithString:mapUrl];

[[UIApplication sharedApplication] openURL:url];

17.日期格式化:

NSDataFormat *format=[NSDateFormat alloc] init];

[format setDateFormat:@”hh:mm:ss”];

NSDate *noew=[NSDate date];

NSString *str=[format stringFromDate:now];

18。webView使用:

webView loadRequest:[NSURLRequest alloc] initwithURL:[NSURL alloc]initWithStringt:@”http://www.google.com“];

18。通過通知調用方法:

UIApplication *app = [UIApplication sharedApplication];

[[NSNotificationCenter defaultCenter] addObserve:self

selector:@selector(xxx:)

name:UIApplicationWillTerminateNofification

object:app];

19。遍歷所有視圖的方法:

其中cell是UITableViewCell,

for(UIView *oneView in cell.contentView.subviews)

{

if ([oneView isMemberOfClass:[UITextField class]])

{

textField = (UITextField *)oneView;

}

}

20.

1、背景音樂播放 支持mp3格式 循環播放長音樂

這種播放音樂的方式導入框架#import

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章