我正在创建一个基于表视图的应用程序.我为表创建了一个自定义表格单元格,其中包含2个标签,1个图像和1个按钮.表视图数据源方法正常工作.我正在为自定义单元格和视图控制器类使用xib,我将委托和数据源连接到文件的所有者.但问题是当我选择表格行时,didSelectRowAtIndexPath没有起火.如上所述,解雇它的唯一方法是按住电池约3-4秒.有谁知道为什么会这样?
谢谢你的任何指示......
这是我的表视图方法..
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [finalAddonsArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
NewCustomCell *cell = (NewCustomCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *nib=[[NSBundle mainBundle]loadNibNamed:@"NewCustomCell" owner:self options:nil];
cell=[nib objectAtIndex:0];
}
Addons *addons1=[[Addons alloc]init];
addons1= [finalAddonsArray objectAtIndex:indexPath.row];
if (addons1.data == nil) {
cell.ivCategory.image = [UIImage imageNamed:@"blogo.jpg"];
}
else
{
cell.ivCategory.image=[UIImage imageWithData:addons1.data];
}
cell.lblTitle.text = addons1.name;
if (addons1.price == nil) {
cell.lblPrice.text = …Run Code Online (Sandbox Code Playgroud) 我正在使用Objective C创建一个应用程序,我正在使用它UIWebView来显示HTML格式的内容.我在UIWebView委托方法中使用下面的代码webViewDidFinishLoad
NSUInteger contentHeight = [[aWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.body.scrollHeight;"]] intValue];
计算视图内容的高度,这是工作的罚款iOS8,iOS9而iOS11但在iOS10iPhone手机的内容高度返回比实际含量值一个更大的价值.因此,我在屏幕上的webview底部获得了一些额外的空白区域.
我尝试了所有的解决方案,但只在iOS 10中获得相同的错误内容高度.请帮我解决这个问题.先感谢您!
我正在使用Objective C处理iPhone应用程序.因为我需要同时关闭两个UIViewControllers,所以我使用下面的代码:
[self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
此代码在iOS6和iOS7中运行良好,但在iOS8中无效.我已经使用断点检查,我的ViewController viewDidLoad和viewWillAppear方法正在调用,但我的视图根本没有加载,所以作为输出,我得到空白的白色屏幕.任何人都可以帮助我,对于iOS8,我该如何解决这个问题,我是否需要使用presentViewController而不是presentViewController?
iphone presentmodalviewcontroller presentviewcontroller ios8
我已经UIButton以UITableView编程方式添加了一个.我的问题是我需要给出Letter Spacing以及需要更改按钮标题颜色.我Letter Spacing使用下面的代码给出了按钮标题文本,但标题文本颜色没有变化.
这是我的代码:
btnLogin = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btnLogin.frame = CGRectMake(0, 0, 320, 42);
btnLogin.titleLabel.font = customFont;
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@"LOG IN"];
[attributedString addAttribute:NSKernAttributeName
value:@(spacing)
range:NSMakeRange(0, [@"LOG IN" length])];
[btnLogin setAttributedTitle:attributedString forState:UIControlStateNormal];
btnLogin.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"cell_highlighted.png"]];
[btnLogin setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; //it's not working.
[btnLogin addTarget:self action:@selector(onClickLogin) forControlEvents:UIControlEventTouchUpInside];
[cell addSubview:btnLogin];
[cell.contentView bringSubviewToFront:btnLogin];
Run Code Online (Sandbox Code Playgroud)
你能帮我解决一下如何更改按钮标题颜色吗?谢谢.
我在按钮操作方法后获取自定义类对象.现在我需要存储多个自定义对象NSMutableArray,然后将此数组存储在其中NSUserDefaults.
这是我的代码:
-(IBAction)onClickSubmitLater:(id)sender
{
//Saving store in user defaults for later upload data.
NSMutableArray *arrayStoreList = [[NSMutableArray alloc] init];
arrayStoreList = [Util getArrayPreference:@"Store"];//arrayStoreList is the list of all stores.
Store *store = [[Store alloc] init];
store = [arrayStoreList objectAtIndex:self.selectedStoreIndex];//here i am getting particular store that i need to save in array.
//archive
NSData *dataStore = [NSKeyedArchiver archivedDataWithRootObject:store];
[[NSUserDefaults standardUserDefaults] setObject:dataStore forKey:@"resultStore"];
//unarchive
NSData *dataResultStore = [[NSUserDefaults standardUserDefaults] objectForKey:@"resultStore"];
Store *resultStore = (Store *)[NSKeyedUnarchiver unarchiveObjectWithData:dataResultStore];
NSLog(@"%@", resultStore); …Run Code Online (Sandbox Code Playgroud) 我正在为iOS 7创建一个应用程序,我需要在我的UITableView中添加UISearchBar.搜索功能工作正常,我的问题是我试图使用下面的代码自定义我的搜索栏UI,以实现我的输出如下截图:

这是我的代码:
searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(40, 29, 266, 27)];
searchBar.delegate = self;
searchBar.barTintColor = [UIColor clearColor];
[[UILabel appearanceWhenContainedIn:[UISearchBar class], nil] setTextColor:[UIColor whiteColor]];
[[UISearchBar appearance] setSearchFieldBackgroundImage:[UIImage imageNamed:@"search-bar.png"]forState:UIControlStateNormal];
NSDictionary *attributes =
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
[UIFont fontWithName:@"HPSimplifiedW01-Regular" size:14.0f], UITextAttributeFont,
nil];
[[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil]
setTitleTextAttributes:attributes forState:UIControlStateNormal];
[[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil]
setTitleTextAttributes:attributes forState:UIControlStateHighlighted];
for (UIView *subView in searchBar.subviews)
{
for (UIView *secondLevelSubview in subView.subviews){
if ([secondLevelSubview isKindOfClass:[UITextField class]])
{
UITextField *searchBarTextField = (UITextField *)secondLevelSubview;
searchBarTextField.clearButtonMode = UITextFieldViewModeNever;
//set font color …Run Code Online (Sandbox Code Playgroud) 我已经在Objective C中开发了一个应用程序,它在所有iPhone手机上运行良好.但是当我在iPhone X Simulator中运行这个应用程序时,我不知道如何在UITableView的顶部获得一些额外的空间(大约20-22像素).我尝试了所有这些解决方案,但以下都没有帮助我:
self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableView.bounds.size.width, 0.01f)];
self.edgesForExtendedLayout = UIRectEdgeNone;
[tblProducts setSectionHeaderHeight:0];
self.automaticallyAdjustsScrollViewInsets = NO;
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return CGFLOAT_MIN;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
return CGFLOAT_MIN;
}
Run Code Online (Sandbox Code Playgroud)
我知道这可以通过设置我的表视图contentInset来实现:
tblProducts.contentInset = UIEdgeInsetsMake(-30, 0, 0, 0);
Run Code Online (Sandbox Code Playgroud)
有没有其他解决方案来解决iPhone X的这个问题?
我在ViewDidLoad中查看了我的表视图框,它是(0,64,WIDTH,HEIGHT),状态栏有问题吗?
请建议我.先感谢您!
我正在使用ARC创建一个应用程序,但由于收到内存警告我的应用程序崩溃了.该应用程序在模拟器中工作正常.但是对于iphone设备,如果我运行应用程序几分钟,然后做任何事情,应用程序直接崩溃.我已经通过xcode仪器检查了我的应用程序.我的应用程序文件夹大小为6 MB,但所有内存分配在xcode仪器上显示为63 MB.
由于这个原因,presentViewController-Animated-Completion在导航过程中变慢.有没有人有任何解决方案为什么会发生这种情况?

我正在Video基于Application. 我Swift iOS在哪里AVPlayer玩Video并设置CIFilters使用Video. AVVideoComposition我必须申请Cool and warm tone filter effects我的Videos(请参见下图)。
我已经尝试了Core Image Filters下面提到的所有方法Apple doc,但没有一个看起来像Cool and warm tone filter effect。
有人可以从事同样的工作吗?请建议我。
ios ×7
objective-c ×5
iphone ×3
uitableview ×2
arrays ×1
cifilter ×1
cocoa-touch ×1
core-image ×1
ios10 ×1
ios7 ×1
ios8 ×1
iphone-x ×1
javascript ×1
memory ×1
swift ×1
uibutton ×1
uisearchbar ×1
uiwebview ×1