小编Mon*_*ona的帖子

确定char是num还是letter

如何确定一个char在C如a或者9是一个数字或字母?

使用起来更好:

int a = Asc(theChar);
Run Code Online (Sandbox Code Playgroud)

或这个?

int a = (int)theChar
Run Code Online (Sandbox Code Playgroud)

c alphanumeric char

48
推荐指数
6
解决办法
20万
查看次数

隐藏 uitabbar 时视图上的空白区域

我知道还有其他关于这个问题的帖子,但它们似乎对我不起作用。当我的应用程序中的 uinavigationcontroller 推送特定视图时,我将视图旋转到横向模式并隐藏选项卡栏。但是,当标签栏隐藏而不是显示它后面的视图时,会显示一个空白区域。

在此处输入图片说明

为了解决这个问题,我按照其他关于这个问题的帖子的建议,在我的 viewDidLoad 方法中使用了以下代码行,但它没有解决它。

[self.view setFrame:CGRectMake(0.0f, 0.0f, 320.0f, 480.0f)];
Run Code Online (Sandbox Code Playgroud)

如果有人知道发生了什么,请帮忙。谢谢,

rotation hide tabbar ios

5
推荐指数
1
解决办法
2552
查看次数

uiscrollview放大和缩小功能无法正常工作

我有一个uiscrollview,里面有一个uiimageview.我希望习惯能够放大图像,因为它是一个很大的图像.scrollview只需要垂直滚动而不是水平滚动.

在添加缩放效果之前,我有以下代码,它按照我的意愿工作,

-(void)viewDidLoad
{
[scrollView setScrollEnabled:YES];
[scrollView setContentSize:CGSizeMake(320, 1690)];
}
Run Code Online (Sandbox Code Playgroud)

所以我做了一些研究,最后得到了以下代码来启用捏缩放,

-(void)viewDidLoad
{
scrollView.scrollEnabled = YES;

[scrollView setContentSize:CGSizeMake(320, 1690)];
scrollView.delegate = self;
//    scrollView.contentSize = instImage.frame.size;
scrollView.minimumZoomScale = scrollView.frame.size.width / instImage.frame.size.width;
scrollView.maximumZoomScale = 2.0;
[scrollView setZoomScale:scrollView.minimumZoomScale];
[[NSRunLoop currentRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate distantFuture]];

 }


 - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {

return instImage;
}


 - (CGRect)centeredFrameForScrollView:(UIScrollView *)scroll andUIView:(UIView *)rView {

CGSize boundsSize = scroll.bounds.size;
CGRect frameToCenter = rView.frame;

// center horizontally
if (frameToCenter.size.width < boundsSize.width) {

    frameToCenter.origin.x = ((boundsSize.width - frameToCenter.size.width) / 2);

}else …
Run Code Online (Sandbox Code Playgroud)

scroll zoom imageview ios

5
推荐指数
1
解决办法
1万
查看次数

如何获得IndexPath

在iPhone应用程序中.

我正在尝试获取indexPath.row值,以在以编程方式创建的tableview中选择的行为基础执行某些操作.

有人可以告诉我为什么indexPath.row值不正确.有点像21487 ...... 3?

NSUInteger nSections = [myTableView numberOfSections];
NSUInteger nRows = [myTableView numberOfRowsInSection:nSections];
NSIndexPath *indexPath = [NSIndexPath indexPathForRow: nRows inSection:nSections];
NSLog(@"No of sections in my table view %d",nSections); 
NSLog(@"No of rows in my table view %d",nRows);
NSLog(@"Value of selected indexPath Row %d", indexPath.row);
Run Code Online (Sandbox Code Playgroud)

谢谢,Aaryan

iphone

2
推荐指数
1
解决办法
1万
查看次数

选择UITableViewCell时,UIButton会被覆盖

我在UITableViewCell中使用了UIButton,可以选择此按钮,金色星形和未选择的灰色星形,如下图所示.

在此输入图像描述

问题是,当选择单元格时,无论是否选择了按钮,它都会变成灰色(这种灰色不同于未选择的恒星模式的灰色).我一直想弄清楚为什么会这样,但没有运气.

在此输入图像描述

这是细胞的实施,

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

UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];    
UIButton *button = [[UIButton buttonWithType:UIButtonTypeCustom]retain];

//set the background of the cells
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed: @"cellBackground.png"]];
cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cellselected2.png"]];

// set the button content
[button setImage:[UIImage imageNamed:@"star.png" ] forState:UIControlStateNormal];
[button setImage:[UIImage imageNamed:@"starSelected.png"] forState:UIControlStateSelected];
[button addTarget:self action:@selector(selectedButton:) forControlEvents:UIControlEventTouchUpInside];
[button setFrame:CGRectMake(280, 10,  24, 24)];

[cell addSubview:button];

return cell;
}
Run Code Online (Sandbox Code Playgroud)

当我在选择单元格时点击按钮时,按钮也会完全消失!

谢谢,

user-interface uitableview ios

2
推荐指数
1
解决办法
2538
查看次数

xcode 4.2 storyboard,segue by code

我试图在编码创建的按钮和故事板中创建的视图之间制作segue?

(该按钮不在故事板中,它是在viewcontroller .m类中创建的)

如果您知道解决方案,请帮助,谢谢,

xcode storyboard segue

2
推荐指数
1
解决办法
5884
查看次数