- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我希望我能正确描述这种情况。当它发生时很容易在屏幕上看到,但很难用语言解释,但我会尽力而为。
我有一个带有固定主视图 (UITableView) 和两个详细 View 之一的 UISplitViewController,具体取决于在主视图中触摸的单元格类型。每个详细信息 View 也是一个 UITableView。我使用 Todd Bates 将 Apple 的 MultipleDetailViews 示例转换为使用 Storyboard作为我的代码的基础 (Adventures in UISplitViewController).
我正在使用 Storyboard,所以这就是解释部分变得棘手的地方。 Master 和第一个显示的 Detail view Navigation Controllers 在 Storyboard 中作为与 UISplitViewController 的关系连接起来。第二个 Detail Navigation Controller 只是坐在 Storyboard中,没有任何连接。
问题来了。细节 #1 在横向模式下处于事件状态,细节 #2 通过点击主视图中的一行设置为事件状态。 iPad 旋转到纵向模式,这会导致细节 #2 为纵向模式正确调整大小。通过轻敲母版中的一行将细节 #1 设置为事件状态。细节 #1 与上次在横向模式下显示时的大小相同,它没有按应有的方式填满屏幕。
我的问题是,我可以告诉当前未显示的 Detail Controller 在方向改变时自行调整大小吗?或者更好的问题是如何调整刚刚显示的详细 View 的大小以填充 UISplitView 的详细信息部分?
我希望我描述的足够详细,以便有人提供帮助。
UISplitViewControllerDelegate 方法在管理器类中实现,该类应该将这些调用转发给详细 View Controller 。下面是该方法的实现:
#pragma mark - UISplitViewControllerDelegate
/* forward the message to the current detail view
* all detail views must implement UISplitViewControllerDelegate
*/
-(void)splitViewController:(UISplitViewController *)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)pc
{
self.masterBarButtonItem = barButtonItem;
self.masterPopoverController = pc;
barButtonItem.title = NSLocalizedString(@"Games", @"Games");
[self.currentDetailController.navigationItem setLeftBarButtonItem:self.masterBarButtonItem animated:YES];
}
/* forward the message to the current detail view
* all detail views must implement UISplitViewControllerDelegate
*/
-(void)splitViewController:(UISplitViewController *)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
{
self.masterBarButtonItem = nil;
self.masterPopoverController = nil;
[self.currentDetailController.navigationItem setLeftBarButtonItem:nil animated:YES];
}
并且我在每个细节 View Controller 中实现了以下内容:
#pragma mark - Split view
- (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController
{
barButtonItem.title = NSLocalizedString(@"Games", @"Games");
[self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
self.masterPopoverController = popoverController;
}
- (void)splitViewController:(UISplitViewController *)splitController willShowViewController:(UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
{
// Called when the view is shown again in the split view, invalidating the button and popover controller.
[self.navigationItem setLeftBarButtonItem:nil animated:YES];
self.masterPopoverController = nil;
}
问题是两个 Detail view controller 都没有接收到这些消息。我看不出它们是如何被触发的...
我看不出转发 didRotateFromInterfaceOrientation: 会如何导致未显示的 Detail Controller 调整自身大小。来自 Apple 的文档:
When the orientation of an iOS–based device changes, the system sends out a UIDeviceOrientationDidChangeNotification notification to let any interested parties know that the change occurred. By default, the UIKit framework intercepts this notification and uses it to update your interface orientation automatically. This means that, with only a few exceptions, you should not need to handle this notification at all. Instead, all you need to do is implement the appropriate methods in your view controller classes to respond to orientation changes.
The window object does much of the work associated with changing the current orientation. However, it works in conjunction with the root view controller to determine whether an orientation change should occur at all and, if so, what additional methods should be called to respond to the change. If this controller is a container, it may rely on a child to decide whether the orientation should occur.
When a rotation occurs, methods of the view controller are called at various stages of the rotation to give the view controller a chance to perform additional tasks. You might use these methods to hide or show views, reposition or resize views, or notify other parts of your app about the orientation change. Because your custom methods are called during the rotation operation, you should avoid performing any time-consuming operations there. You should also avoid replacing your entire view hierarchy with a new set of views. There are better ways to provide unique views for different orientations, such as presenting a new view controller (as described in “Creating an Alternate Landscape Interface”).
1 Câu trả lời
与 splitViewController 方法类似,您应该转发以下调用:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
// Forward to detail view controller here:
}
到不可见的详细 View Controller (即不是 self.currentDetailController,而是另一个)。
关于uitableview - UISplitViewController 详细 View 不在旋转时调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9661904/
Tất cả những khác biệt đã biết giữa SQLite, Nhà cung cấp nội dung và Tùy chọn chia sẻ. Nhưng tôi muốn biết khi nào sử dụng SQLite hoặc Content Provider hoặc
CẢNH BÁO: Tôi đang làm việc với một backend mà tôi không kiểm soát hoàn toàn, vì vậy tôi đang vật lộn với một số cân nhắc trong Backbone có thể được giải quyết tốt hơn ở nơi khác... thật không may, tôi không có lựa chọn nào khác ngoài việc giải quyết chúng ở đây! Vì vậy,
Tôi đã vật lộn cả ngày rồi. Biểu thức tìm kiếm theo kiểu gõ đầu của tôi hoạt động hoàn hảo với dữ liệu json từ xa. Nhưng khi tôi thử sử dụng cùng dữ liệu json làm dữ liệu tìm nạp trước thì không có gợi ý nào cả. Sau khi nhấp vào dấu hiệu đầu tiên, tôi nhận được thông báo được xác định trước "Không tìm thấy bất kỳ thứ gì...", với kết quả
Tôi đang tạo một chương trình mô phỏng xổ số NHL, trong đó phải có một JTextField ở bên phải màn hình và quả bóng dự thảo nảy được vẽ ở bên trái. Tôi đã tạo một lớp có tên là Ball triển khai Runnable và trong Draf chính của tôi
Câu hỏi này đã có câu trả lời: Làm thế nào để tính khoảng thời gian trong Java và định dạng đầu ra? (18 câu trả lời) Đã đóng 9 năm trước. Đây là mã của tôi
Tôi có một ứng dụng ASP.NET Web API đang chạy trên phiên bản IIS cục bộ của mình. Ứng dụng web được cấu hình bằng CORS. Phương pháp Web API mà tôi gọi tương tự như: [POST("/API/{foo}/{ba
Tôi lấy thời gian và ngày tháng đầu vào của người dùng như sau: DatePicker dp = (DatePicker) findViewById(R.id.datePicker); TimePicker tp = (TimePicker
Liệu việc nới lỏng tiêu chuẩn “hàng xóm” có đủ không, hay có những hành động tiêu chuẩn khác có thể được thực hiện? Câu trả lời hay nhất Nếu tất cả các giải pháp liền kề đều là Tabu, có vẻ như danh sách Tabu của bạn quá dài hoặc chính sách phát hành của bạn quá nghiêm ngặt. Độ dài danh sách Tabu tốt là
Tôi đang đọc ví dụ mã này từ cppreference: #include #include #include #include template void print_queue(T& q)
Tôi phát điên mất, tôi đang cố gắng hiểu hành vi của chú giải công cụ nhưng không thành công. 1. Vấn đề đầu tiên là khi tôi thử sử dụng nó trong sự kiện nhấp chuột thông qua plugin (Nút 1) -> Nếu bạn vào Fiddle, bạn sẽ thấy bên trong 'Nội dung' rằng hàm được gọi ở mỗi lần nhấp chuột
Tôi có đoạn mã sau trong một thành phần chức năng: const [folder, setFolder] = useState([]); const folderData = useContext(FolderContex
Tôi đang gặp sự cố khi lấy hình ảnh từ S3 bằng URL được chỉ định trước và AFNetworking 3.0. Tôi có thể lấy hình ảnh bằng NSMutableURLRequest và NSURLSession, nhưng khi tôi sử dụng AFHT
Tôi đang gặp sự cố với trình quản lý Oracle UCP khi sử dụng Oracle ojdbc 12 và Java 8. Khi nhóm UCP không khởi động được, tôi muốn đóng các kết nối mà nó tạo ra. Khi ORA-02391: vượt quá
đóng cửa. Câu hỏi này cần có thông tin chi tiết hoặc rõ ràng. Hiện tại không chấp nhận câu trả lời. Bạn có muốn cải thiện câu hỏi này không? Thêm chi tiết và làm rõ câu hỏi bằng cách chỉnh sửa bài đăng này. Đã đóng 9 năm trước. Cải thiện
Tham chiếu đến plunker này: https://plnkr.co/edit/GWsbdDWVvBYNMqyxzlLY?p=preview Tôi đã chỉ định trong tệp styles.css và trong tệp src/app.ts
Tại sao thanh của tôi lại mỏng thế? Tôi đã thử đặt chiều rộng thành 1 và chúng trở nên thực sự dày. Tôi không biết phải thử cách nào khác nữa. Độ dày mặc định là 0,8, vậy có nên như vậy không? nhập matplotlib.pyplot dưới dạng plt nhập
Truy vấn thực thi như mong đợi khi tôi viết: SELECT id, day2.count - day1.count AS diff FROM day1 NATURAL JOIN day2; Nhưng điều tôi thực sự muốn là một phép nối đúng. khi
Tôi có dữ liệu thời gian sau: 0 08/01/16 13:07:46,335437 1 18/02/16 08:40:40,565575 2 14/01/16 22:2
Một số thông tin cơ bản - máy chủ NodeJS của tôi đang chạy trên cổng 3001 và ứng dụng React của tôi đang chạy trên cổng 3000. Tôi đã thiết lập một proxy trong ứng dụng React package.json của mình để proxy cho đối tác
Tôi đang gặp phải một vấn đề ngớ ngẩn. Tôi đang cố gắng tải chậm hình ảnh của mình vào ứng dụng Angular, tôi đã thử cách này 2: Nhưng cả hai đều đặt thuộc tính src thay vì data-src, tôi có bỏ sót điều gì ở đây không? Giữ d
Tôi là một lập trình viên xuất sắc, rất giỏi!