小编ing*_*por的帖子

不需要的双导航栏

当我点击屏幕时,我使导航栏(顶部栏)出现/消失,并且还位于背景图像的顶部.它有效,但有一个问题:我突然有两个导航栏!首先,一个带有一个名为"Back"的后退按钮,当我按下"Back"时,它弹出一个新的导航栏,后面有一个名为"Vinene"的后退按钮,这是它返回的TableView的标题.那就是我想保留的那个.我认为问题出在DetailViewController.m或MasterViewController.m中的didselectrowatindexpath中.希望有人能看到问题!

DetailViewController.m:

@interface WinesDetailViewController ()

@end

@implementation WinesDetailViewController

@synthesize wineDictionary;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
    // Custom initialization
}
return self;
}

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];

}

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.

self.navigationController.navigationBar.translucent = YES;
                         self.wantsFullScreenLayout = YES;

UITapGestureRecognizer *tap = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideShowNavigation)] autorelease];
                                                                                                         tap.numberOfTapsRequired = 1;
                                                                                                 [self.view addGestureRecognizer:tap];
}

- (void) hideShowNavigation
{
[self.navigationController setNavigationBarHidden:!self.navigationController.navigationBarHidden];
}

- (void)viewDidUnload …
Run Code Online (Sandbox Code Playgroud)

iphone xcode uinavigationbar uinavigationcontroller

6
推荐指数
1
解决办法
2832
查看次数

基于UITabBarController的应用程序的共享iAd横幅,使用带故事板的XCode 4

故事板iAd标签栏控制器示例项目

1:下载Xcode 4.2的示例项目

2:从每个视图中在标签栏上方显示横幅

3:回答

4:收到赏金

5:让别人开心,我会把它教给你.没有这个重要步骤atm的现有教程.

xcode uitabbarcontroller uiviewcontroller uinavigationcontroller iad

6
推荐指数
1
解决办法
1756
查看次数

使故事板中的场景更长或滚动它

我在故事板上工作,我的一个滚动视图比iPhone屏幕长(显示一些长文本).在模拟器中滚动没问题,但有没有办法在故事板中向下滚动滚动视图?

我有一个小小的记忆,看到一个教程,其中故事板中的屏幕被"拉伸"更长,因此它显示了整个滚动视图.但这可能是在梦中.有谁知道怎么做这样的事情?

编辑:

下面的答案说,你可以用两个手指拖动滚动滚动视图,但我不能.可能是因为scrollview直接放在ViewController中而后面没有UIView吗?我是否应该背后有UIView?它工作正常,除了我无法在故事板中滚动.

iphone xcode interface storyboard uiscrollview

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

UISearchDisplayController和自定义单元格

我在UITableViewController中实现了一个UISearchDisplayController.搜索工作正常,但UISearhDisplayController创建一个带有标准单元格的新tableView,而我的tableView正在使用自定义单元格.另一个问题是我使用了一个segue:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 
Run Code Online (Sandbox Code Playgroud)

而且searchResultsTableView中的单元格没有触发segue ..

如何使用自定义单元格和segue工作显示搜索结果?

这是代码:

...

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (tableView == self.searchDisplayController.searchResultsTableView){ 
return [nameFilteredObj count];
} else {
return [sortedObj count];
}}

- (CustomCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"customCell";

CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {
cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
if (tableView == self.searchDisplayController.searchResultsTableView)
{
cell.textLabel.text = [[sortedObj objectAtIndex:indexPath.row] valueForKey:@"Name"];
 } else {
cell.nameLabel.text = [[sortedObj objectAtIndex:indexPath.row] valueForKey:@"Name"];
cell.countryLabel.text = [[sortedObj …
Run Code Online (Sandbox Code Playgroud)

iphone xcode objective-c ios

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

标签栏控制器(故事板模板)和AppDelegate

当我为带有故事板的TabBarController创建一个XCode 4 iPhone模板时,它会自动配置一个主视图控制器和一切.但AppDelegate中的Tab Bar Controller没有任何特色.我可以为它创建一个插座,并尝试将其与故事板中的Tab Bar Controller链接,但这是不可能的.有没有更好的方法来访问didFinishLaunchingWithOptions方法中的标签栏控制器,因为它已经有点连接?我想要的是标签栏控制器中的self.currentController =当前选项卡.

AppDelegate.h:

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end
Run Code Online (Sandbox Code Playgroud)

AppDelegate.m:

@interface AppDelegate()

@property (nonatomic, assign) UIViewController<SubViewContainer> *currentController;

@end

@synthesize window = _window
@synthesize currentController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

//I need this piece of code to equal the Tab Bar Controller current tab
self.currentController = ?

return YES;
}

//And I'm gonna use this void for some statements about the Tab Bar Controller tabs:
- (void)tabBarController:(UITabBarController …
Run Code Online (Sandbox Code Playgroud)

iphone xcode delegates storyboard uitabbarcontroller

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

搜索一系列词典

我正在制作一个iPhone应用程序,显示有关红葡萄酒的信息.这些葡萄酒储存在含有一系列字典的plist中.我正在向应用程序添加一个搜索视图控制器,并且为了轻松启动我想要获得"Name"键的值包含 nameString(来自文本框)的葡萄酒.

它有点停在这里,我需要一些关于最合适的方法的建议.NSArray类中是否有一个函数可以执行此任务,应该引入NSPredicate,NSUserDefaults,还是有其他选项?我做了一些研究,但我需要一些建议,也许是一个开始的例子.

我将推进搜索功能,让用户包括/排除国家,获得适合这种和那种食物的葡萄酒,设定最低价格,最高价格等.字典包含所有这些信息的字符串.所以在我开始这样的高级之前,我需要一些建议,哪些功能可以最好地完成我的工作.

-(IBAction)searchButtonPoke:(id)sender{

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Wines" ofType:@"plist"];
    allObjectsArray = [[NSMutableArray alloc] initWithContentsOfFile:path];

    NSString *nameString = [NSString stringWithFormat:@"%@", [nameTextField text]];

    resultObjectsArray = /*objects where the value for the key "Name" contains
                                                                   nameString*/;
Run Code Online (Sandbox Code Playgroud)

iphone search xcode objective-c nsmutablearray

3
推荐指数
2
解决办法
6903
查看次数

使用XCode向iPhone应用程序添加一个复选框(或类似)

当我在编辑器中时,我注意到对象库中有复选框.但是当我去故事板时它们就消失了.那么有没有办法在iPhone界面中添加chechbox或者它们是否适用于其他平台?如果不可能,还有其他什么可以做同样的工作吗?我正在制作搜索功能,如果检查了chechbox,我想在搜索中添加一个标准,这就是为什么我需要这样的东西.谢谢.

iphone xcode interface button storyboard

3
推荐指数
1
解决办法
7910
查看次数

不调用AppDelegate中的didSelectViewController

这就是我告诉didFinishLaunchingWithOptions有关在故事板中创建的标签栏控制器的方法.它现在在主选项卡中显示iAd横幅.但是当我点击其他标签时没有任何反应.永远不会调用didSelectViewController.如何将didSelectViewController连接到我的TabBarController并将currentController属性分配给当前/活动选项卡?

#import "AppDelegate.h"

@interface AppDelegate()

@property (nonatomic, retain) ADBannerView *bannerView;
@property (nonatomic, assign) UIViewController<BannerViewContainer> *currentController;

@end

@implementation AppDelegate

@synthesize window = _window;
@synthesize bannerView;
@synthesize currentController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch

    CGRect screenBounds = [[UIScreen mainScreen] bounds];

    // bannerView was here

    // This is the reference to the tab bar controller and first tab from storyboard.
    UITabBarController *tabController = (UITabBarController *)self.window.rootViewController;
    self.currentController = [[tabController viewControllers] objectAtIndex:0];

    NSLog(@"Root: %@", self.window.rootViewController);
    NSLog(@"Tab with …
Run Code Online (Sandbox Code Playgroud)

iphone xcode delegates objective-c uitabbarcontroller

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

使用XCode 4在视图中添加更多委托协议

@interface WinesViewController : UITableViewController <UIActionSheetDelegate> {
    NSMutableArray *sortedObjects;
}
Run Code Online (Sandbox Code Playgroud)

在上面的代码中,添加了UIActionSheetDelegate协议,因为我使用UIActionSheet对TableView进行排序,它需要一个委托.现在我在DetailViewController中添加一个SwipeGestureRecognizer,从Detail View中访问TableView中的下一个单元格.我正在使用的教程告诉我在TableViewController中为DetailViewController添加委托协议.它告诉我以与我已经添加UIActionSheetDelegate完全相同的方式添加它,那么现在如何为DetailViewController添加委托?

iphone xcode delegates protocols view

0
推荐指数
1
解决办法
2199
查看次数

获取正确的字典索引

    NSMutableArray *tmpMutArr = [NSMutableArray arrayWithArray:allObjectsArray];
    NSLog(@"The content of array is%@",tmpMutArr);

    int index;

     for (int i=0;i<[tmpMutArr count];i++) 
     {
     if([[tmpMutArr  objectAtIndex:i] isKindOfClass:[NSDictionary class]])
     {
     NSMutableDictionary *tempDict = [tmpMutArr  objectAtIndex:i];
         if([[tempDict valueForKey:@"Name"] isEqualToString:[NSString stringWithFormat:@"%@", nameString]])
     {
     index = i;

     }
     }
     }

     [tmpMutArr replaceObjectAtIndex:index withObject:[NSDictionary dictionaryWithDictionary:mutDict]];
Run Code Online (Sandbox Code Playgroud)

此代码不会像我想要的那样替换tmpMutArr中匹配对象,而是替换tmpMutArr中的所有对象.如何只替换我想要的索引?

我知道tmpMutArr在替换之前包含所有对象,所以我只需要正确指定索引.怎么办?

indexing objective-c nsmutablearray

0
推荐指数
1
解决办法
1256
查看次数