0

我是iOS開發新手。我在添加插頁式廣告ViewDidLoad,但我想在用戶在我的應用程序中點擊十次時顯示插頁式廣告,這是可能的嗎?如果有可能,請幫我找到解決方案。我的應用程序包含HMSegmentedControll,它有十個不同的UITableView。我還想在按下NavigationBar後退按鈕時顯示這些廣告。任何人都可以幫助我嗎?如何在導航後退按鈕和某些點擊事件時加載插頁式廣告?

回答

0

線輪ü可以添加除計數 「回水龍頭」

在GlobalVariables.h文件是這樣的一些全局值:

extern int PRJ_back_touches_count; 

.M:

int PRJ_back_touches_count; 

比例如在viewWillDisappear方法PRJ_back_touches_count ++

在viewDidAppear u能處理PRJ_back_touches_count實際值

2

有可能像如SharedPreference Android中

做一個全局變量的NSObject等作爲

GlobalVariable.h文件

@property (assign) int touchCount; 
+ (TouchCount *)getInstance; 
@end 

and GlobalVariable.m文件

@synthesize touchCount; 
static TouchCount *instance = nil; 

+(TouchCount *)getInstance 
{ 
@synchronized(self) 
{ 
    if(instance==nil) 
    { 
     instance= [TouchCount new]; 
    } 
    if (instance.touchCount ==10) 
    { 
     instance.touchCount=0; 
     instance= [TouchCount new]; 
    } 
} 
return instance; 
} 

而當你想觸摸計數進口GLobalVariable.h喜歡使用這個實例作爲

TouchCount *obj=[TouchCount getInstance]; 
相關問題