Please remember US GAAP and IFRS treat few items differently, but here is a basic rule.
CFF : When corporation raise fund (cahs inflow, for example, bond issuance, equity) or make payments to its share holders, creditors ( cahs outflow: pay debt principal (but not interest), share repurchase etc).
CFI: When coporation sell its fixed assets(cash inflow, for example, sale of a machinery), or puchase fixed assets (cash outflow, for example, purchase of a building).
CFO : everything else which is not included into above.
Very important: please go through , how U.S. GAAP and IFRS classify few items under different category. On some items above rule might not apply.