tableView一行显示多个视图



__FUNCTION__   get the function name



6-4


NSBundle *bundle = [NSBundlemainBundle];

NSString * path = [bundlepathForResource:[NSStringstringWithFormat:@"test-Info"

ofType:@"plist"];

得到的是App中的文件

(gdb)po bundle

NSBundle </Users/userName/Library/Application Support/iPhone Simulator/4.2/Applications/BE308073-FA13-49B3-AF6D-2591AF165E07/test.app> (loaded)


NSArray *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);

NSString *path0 = [pathsobjectAtIndex:0];

NSString *filename = [path0stringByAppendingPathComponent:@"test-Info.plist"];

NSLog(@"=========== %@", filename);


得到的是Documents中的文件

2012-06-04 14:31:23.235 Hitalk[2240:fe03] =========== /Users/sunyu/Library/Application Support/iPhone Simulator/4.2/Applications/BE308073-FA13-49B3-AF6D-2591AF165E07/Documents/Hitalk-Info.plist




(gdb)po appInfo

{

    CFBundleDevelopmentRegion = "zh_CN";

    CFBundleDisplayName = HiTalk;

    CFBundleExecutable = Hitalk;

    CFBundleIdentifier = "com.hoperun.Hitalk";

    CFBundleInfoDictionaryVersion = "6.0";

    CFBundleName = Hitalk;

    CFBundlePackageType = APPL;

    CFBundleSignature = "????";

    CFBundleSupportedPlatforms =     (

        iPhoneSimulator

    );

    CFBundleURLTypes =     (

                {

            CFBundleURLSchemes =             (

                wb3606437869

            );

        }

    );

    CFBundleVersion = "1.0";

    DTPlatformName = iphonesimulator;

    DTSDKName = "iphonesimulator4.2";

    LSRequiresIPhoneOS = 1;

    "Localization native development region" = English;

    NSMainNibFile = MainWindow;

    UIDeviceFamily =     (

        1

    );

}



可以修改info.plist中的设置,但是程序需要重新加载



- (void) changeSysLanguageSetting

{

NSBundle *bundle = [NSBundlemainBundle];

//App

NSString * path = [bundlepathForResource:[NSStringstringWithFormat:@"Info"

ofType:@"plist"];

//document

NSArray *paths =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);

NSString *path0 = [pathsobjectAtIndex:0];

NSString *filename = [path0stringByAppendingPathComponent:@"NAME-Info.plist"];

NSLog(@"=========== %@", filename);

NSLog(@"=========== %@", path);

//[[NSBundle mainBundle] pathForResource:fileName ofType:@"plist"];

NSMutableDictionary * appInfo = [[NSMutableDictionaryalloc]initWithContentsOfFile:path];

if (appInfo !=nil && [appInfocount] >0

{

NSInteger langID = [SettingManagersharedInstance].m_currentLanguage;

if (langID ==Language_Chinese)

{

//[appInfo setValue:@"China" forKey:@"Localization native development region"];

[appInfosetValue:@"zh_CN"forKey:@"CFBundleDevelopmentRegion"];

}

else 

{

//[appInfo setValue:@"English" forKey:@"Localization native development region"];

[appInfosetValue:@"English"forKey:@"CFBundleDevelopmentRegion"];

}

[appInfowriteToFile:pathatomically:YES];

}

[appInforelease];

}



@implementation SystemPhotoView


@synthesize m_delegate;


- (void) picChoosed: (NSInteger)pid

{

NSLog(@"choosed %d", pid);

if (m_delegate !=nil)

{

[(A *)m_delegatepicChoosed:[m_pngArrayobjectAtIndex:pid]];

}

}


- (id)initWithFrame:(CGRect)frame {

    

   self = [superinitWithFrame:frame];

    if (self) {

//set the value of the png array

m_pngArray = [[NSArrayarrayWithObjects:  @"11",@"22",nil] retain];

//add tableView

m_tableView = [[UITableViewalloc]initWithFrame:CGRectMake(5,5,310,400) ];

m_tableView.delegate =self;

m_tableView.dataSource =self;

m_tableView.separatorColor = [UIColorclearColor];

//m_tableView.backgroundColor = [UIColor redColor];

[selfaddSubview:m_tableView];

    }

   returnself;

}


/*

// Only override drawRect: if you perform custom drawing.

// An empty implementation adversely affects performance during animation.

- (void)drawRect:(CGRect)rect {

    // Drawing code.

}

*/


#pragma mark -

#pragma mark UITableViewDataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

{

return1;

}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{

return ([m_pngArraycount] + NUM_OF_EACH_ROW - 1) /NUM_OF_EACH_ROW;//Regard to ZhangXiaoxiang

}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

{

return55;

}



#pragma mark -

#pragma mark UITableViewDelegate

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

staticNSString *CellIdentifier =@"CellIdentifier";

UITableViewCell *cell = [tableViewdequeueReusableCellWithIdentifier:CellIdentifier];

if (cell ==nil

{

//initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier

cell = [[[UITableViewCellalloc]initWithFrame:CGRectMake(0,0,320,60

 reuseIdentifier: CellIdentifier]autorelease];

for (int i =0; i <NUM_OF_EACH_ROW; i++)

{

SysProfileView * tmpView = [[SysProfileViewalloc]initWithFrame:

CGRectMake(1 +50 * i,2, 50, 50)];

tmpView.tag =1000 + i;

tmpView.m_delegate =self;

[celladdSubview:tmpView];

[tmpViewrelease];

}

}

cell.selectionStyle =UITableViewCellSelectionStyleNone;//选中后不显示蓝色背景

for (int i =0; i <NUM_OF_EACH_ROW; i++)

{

int pos = [indexPathrow] *NUM_OF_EACH_ROW + i;

SysProfileView * tmpView = (SysProfileView *)[cellviewWithTag:1000 + i];

if (pos >= [m_pngArraycount])

{

tmpView.hidden =YES;

}

else 

{

//if the image do not change, it need not to be reset  

if (tmpView.m_btn.tag != pos)

{

[tmpViewsetPng: [m_pngArrayobjectAtIndex:pos]];

}

tmpView.hidden =NO;

}

[tmpViewsetM_btnTag:pos ];

}

return cell;

}


- (void)dealloc 

{

[m_tableViewrelease];

[m_pngArrayrelease];

    [superdealloc];

}



@end




======


[self.navigationController.navigationBarsetNeedsDisplay];



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值