我已正确实施@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_homescreen);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
getSupportActionBar().setCustomView(R.layout.bar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_open){
@Override
public void onDrawerClosed(View view) {
super.onDrawerClosed(view);
}
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
super.onDrawerSlide(drawerView, 0);
}
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
super.onDrawerSlide(drawerView, 0); // this disables the animation
}
};
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
,以便按部分拆分我提取的数据。当我尝试打印其属性NSFetchedResultsController
时,我只获得sectionIndexTitles
,但如果我遍历其各个部分并打印出部分名称,则会打印出每个部分的名称:
"0"
我认为dump(fetchedResultsController.sectionIndexTitles)
// prints out "0"
var names = [String]()
for val in (fetchedResultsController.sections)! {
names.append(val.name)
}
dump(names)
// prints out: - "03/31/2017"
- "04/01/2017"
- "04/02/2017"
会返回所有部分的数组'名字,这是不正确的?